stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Well moved from C++ to Java (In college) and found the transition easier, then I had to temporarily move to C++ from a project and initially it was hell.
So if you already have worked on C++ and have put in some amount of effort in Java, I would suggest sticking to Core Java.

ALso I do not understand why you feel Python or PHP would be any easier to learn than Java, if you try to cover the same concepts in those languages, I think it should take a similar amount of effort.

Another thing I feel is you might be looking at this the wrong way. You should be focussing on your Data Structures and design skills (Object Oriented Analysis and Design), you might learn and become familiar with Collections API, etc but in the end we programmers are just problem solvers, good interviewers usually try to see your approach on analysing a problem and designing solutions for it.
Finding out whether to use a HashMap or a TreeMap or TreeSet or HashSet for a given situation in your data structures is easy (either google or just read the javadocs).
It is the how you think about the problem which is imp not just for interview, it will help you even on the job.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

The Program is looking for a class called: "javaapplication7.TelephoneDirectory"
Your class (atleast the code you pasted) is in the default package, you need to declare your classes to be in the "javaapplication7" package by adding the following statement at the top of your Java file (Even before the import statements)

package javaapplication7;

Also note your classfile will need to be in a folder called 'javaapplication7'.
If you are doing this via an IDE, then I suppose it will handle these teenie weenie details.

stultuske commented: missed that one, should 've read the code more carefully :) +15
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Checkout the Scanner tutorial here: http://docs.oracle.com/javase/tutorial/essential/io/scanning.html , the example mentioned is doing something similar.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Hi everyone,

I am doing a Java course at uni at the moment and it kinda doesn't make you become a real programmer with the confidence that a programmer should have. I really want to program in Java and any language(not python though because it is not a user-friendly programming language... its syntax is horrible!!! sorry python programmers) The problem I'm facing is that I don't know how to think like a real programmer.. If anyone can help, that'd be GREAT and be a life saver for a young man like me..

Looking forward to fellows' thoughts on this...

You seem to be looking for a fast track way to become a good programmer and no just positive thinking isn't enough, and you are correct your course will not perform some enchantments on you that viola at the end of it you will become a good programmer.

A programmer is just a problem solver, First hes given a problem, next he has to solve it, When he successfully solves the problem, he backtracks on the steps he used to solve the problem (the Algorithm) and then converts the steps into code.

And how do you get good at solving problems ... by solving problems (start small like printing the pascal triangle or some patterns and slowly moving up).

Ezzaral commented: Agreed. +15
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

No information about what is wrong, no information on how you expect it to work, no problem description, no code tags, Well I guess someone will have to use a crystal ball to help you out here.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

that how can we implement BFS algo. in Java.

Translate the Algo into Java code and you will have its implementation.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

hi.....
i need to do a project on bulk sms.
i request you to send
java application for sending bulk sms from pc to mobile
by
kareena

I think the idea of it being your project is that you should make the application, not rip someone's hard work for your marks (if its an academic project) or money (if you are doing it commercially).

You have in this thread what you need to start making your own application, if you run into any road blocks you can definitely count on the people in this community to help out, but only if you put in the effort.

peter_budo commented: Obviously some students do not get it that in deed has to be their work not stolen material +15
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Just to complicate it some of the books have more than one author

No offence meant here, but problem seems like an outcome of bad table design. There are are currently two entities which I can see in your data model: Author and Title.

Now one Author can have multiple Titles, while a single Title can have multiple Authors. This is a many-many relationship and to model it correctly you need a third table (example AuthorTitleMap), which maps the title_id to the author_id and they together will form the primary key of the third table. (Also you would have to remove the title_id in the author table)

Also while inserting the data insert first into the Title Table, them the Author table and finally into the AuthorTitleMap.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

u could hv used code tags to post d code here

n plz also post wht errors u r getting

Since you are reminding each other of the rules, here is one for both of you:-

Keep It Clean
We strive to be a community geared towards the professional. We strongly encourage all posts to be in full-sentence English. Please do not use "leet" speak or "chatroom" speak.

http://www.daniweb.com/forums/faq.php?faq=daniweb_policies

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Quote from the Announcement at the top of the Java forum:-

..., to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Well Sorry to burst the bubble here, But there is a well known work around for the problem you mentioned. If you need to access the Class member in your inner class in the above situation use the following syntax:-

<Outer_Class_Name>.this.<Member_Name>

The following example should drive the point home:-
(Note have used a Method Local Inner Class instead of an anonymous inner class just to simplify the example)

public class OuterClassDemo {
  // The displayText variable of the OuterClass
  private String displayText="OuterDisplay";

  public OuterClassDemo() {
    // Here we are declaring the local displayText variable,
    // it has been declared as "final" as I want to access it
    // inside the inner class methods
    final String displayText="LocalDisplay";
    class InnerClass {
      public void show() {
        System.out.println("OuterDisplay : " + OuterClassDemo.this.displayText);
        System.out.println("Local DisplayText : " + displayText);
      }
    };

    // Instantiate the inner class and invoke the show() method.
    InnerClass ic = new InnerClass();
    ic.show();
  }

  public static void main(String[] args) {
    new OuterClassDemo();
  }
}

The output the above program would give is:-

stephen@home:~$ java OuterClassDemo
OuterDisplay : OuterDisplay
Local DisplayText : LocalDisplay

So as you see there is no problem in accessing the "displayText" variable of the outer class, even though the method/constructor in which the class is declared has a local variable with the same name.

kvass commented: Solid, insightful post. Good catch :) +1
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Any suggestions / code examples for Encryption/Decryption of files(any file format) in java.
command line args - <inputfilename> <outputfilename>

Show us what you have tried first please.

Salem commented: Well said +18
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

hi..
where can i get the java source code for multiple regression...

On your hard drive, in the folder you saved it, once you have typed it out in an IDE.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

The Eclipse java compiler is OK, The problem is your runtime which you are using 'GCJ', I would suggest you use the JRE from the Sun site directly which I had linked to in the first post. Remember there are two components which process your program currently:-
First the compiler which compiles your code to the class file (javac)
Second the JRE or the Java Virtual Machine which runs your programs (java).
The Eclipse compiler is fine, but since you are just starting out, rather than use your compiler and runtime from different third party vendors, I would suggest you stick to the original SUN JDK (which includes both of them) which I had linked in the first post.
Also to make it simpler to install do not download the ".rpm.bin" version of the jdk, instead use the ".bin" version.

Also if you are just starting Java then stick with the basic editors only like emacs or vim, once you are familiar with the ins and outs of Java then jump to Eclipse or Netbeans or even Peter's Favourite Intellij IDEA.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

First of all, I actually am using the javac compiler.

'javac' is not a compiler, it is a command/executable which comes with all compiler implementations for java for compiling your source code. So irrespective of whether you are using the JDK from BEA, IBM, Sun, GCJ, Oracle etc most of them should give you a javac executable to compile your source code.

Since I guess you are on Linux, so you must be using the Ecipse Java Compiler in combination with the GCJ runtime. The fact that you are using GCJ to run your application is clear from this error in your first post:-

at gnu.java.lang.MainThread.run(libgcj.so.90)

To check which version of the compiler you are using shoot:

javac -version

Peter has mentioned is the correct way to run your programs, you mention the main class name only and leave out the ".class" extension.
Finally make it a point to follow a set of standard coding conventions from the start for naming your classes, packages, identifiers etc. Here is a link to the Sun Java Code Conventions or you could use this style guide from javaranch.com which is more suitable for beginners.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

So...I have just begun to whet my appetite for Java today, and I have already run into a stumbling block.

If you have just begun Java, then I would strongly recommend using the JDK (Java Development Kit which includes the javac compiler and other stuff) directly available from Sun itself here, rather than going for third party compilers like the GCJ.

Also after you compiled your application, do you see a 'test.class' file generated inside your current working directory ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I need java program for SHA message digest and encrytion and decryption in RSA

Ok thank you for informing us about your need, hope you succeed in writing it.

Dukane commented: lol nice response +3
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Well you seem to be confused a lot, if what you are doing is for a production system for some organization I suggest you hand over the task to someone who knows what he is doing.

On the other hand if this is just some past time project you are doing to get your concepts clear in Java, then you need to learn a lot more. I will clarify a few facts for you here.

Firstly CentOS is not a web server, it is an Operating System, just like Windows XP. Apache Tomcat is a Web Server, and you need that along with a JRE (Java Runtime Environment) to run your servlets/JSPs.
Here is a good tutorial on installing the Sun JRE and Tomcat on CentOS 5.

Also as far as deploying your web application is concerned, according to me the best approach would be to package it into a properly organized WAR file and then deploy using the "Tomcat Manager" web application.

Also here are some more links to help you out:-
Apache Tomcat Documentation
Apache Tomcat Download Link
CentOS 5 Documentation


Also one final note, I would not recommend using the Apache Tomcat version that comes in repositories of CentOS, as it is configured to work with gcj which is only partially compliant with the 1.4.2 version of the JRE and although getting it to work with the Sun …

peter_budo commented: Good explanation. +22
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I agree with VernonDozier, your code compiled and ran OK,
You should not be getting this problem unless and until you are using a Java compiler prior to release 1.2 (i.e a pre Java2 compiler cause nextInt(int) was added to the java.util.Random class in JDK 1.2)

freelancelote commented: thanks a lot +1
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

My code compiles but does not print the contents of the ExtendDVD class. I have the three classes saved as seperate files.

Well just a quick Search of your code revealed that you have never created an Object of ExtendDVD so I guess its logical that nothing from it would be printed.

VernonDozier commented: Beat me to it! +15
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Rather than making your own why dont you just try some of the freely available Database Connection Pooling libraries.
Look here for a list of them, For my apps I normally used the DBPool library.
Alternatively if you are using Tomcat you can check this article

So if you use a standard pool of database connections, whenever you wish to query the database, just checkout a connection from the pool, fire your query, process the resultset if any and return the connection back to the pool.
So you neither will have the problem of continuously opening and closing connections nor the problem for one user occupying one DB connection for his entire session.
Also you can read the following references to know more about the importance of Connection pooling : 1,2

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Then I tried to emulate file system I had no idea how to do that. BoxedApp SDK helped very much.
(But that project I wrote in C++:) )

And I am sure the guy has already solved his problem 3 years ago, Talk about speedy replies !!!!

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I do not know how to execute a macro, but what you could do is Query your MS-Access database and write the values from the recordset into a file CSV format (which can be opened in Excel) or alternatively you could use Apache POI to write it out in the proprietary Excel format.

Ezzaral commented: Sounds good to me. +21
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

This should help. It was the first search result in Google.

Ezzaral commented: That Google guy knows all kinds of good stuff! +21
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Without a space on either side of =

Used to do the same before Peter_Budo told me about the noparse tags.

You can use the noparse tags around your code block like this :-

[noparse] [code=xyz]

[/code]
[/noparse]

You can read more about the various vB tags here.

jephthah commented: ah... THAT'S what i was looking for! +7
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I've done the layout but now I don't know to implement the maths.

The quick approach which comes to my mind is store a,b,c and d in an array say "coefficients" of size 4 and let the index at which the corresponding value is stored indicate the power of "x".
Ex:-

coefficients[0]=d;
coefficients[1]=c;
coefficients[2]=b;
.....

Now to calculate value of "y" corresponding to the given value of "x" would be as simple as summing up the value of :-

y = coefficients[index] * Math.pow(x,index);

for every element in the coefficients array.

The second approach to calculate the value of "y" which the programmer in me despises is the more mechanical approach as show below:-
Assumptions:- Current value of "x" is in variable "x" and same applies for a,b,c and d.

y = a * x *x *x + b * x * x + c * x + d;

Notes:-
If you wish to try the first approach you may read about arrays here and here.
Here and here are example how to parse through arrays using the "for" loop and "for each" loop respectively.
You can also see that javadocs of the Math class for the pow() method

Salem commented: Nice +29
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Peter has already mentioned the cause of your problem, now just wanted to add a few notable things like :-

  1. You never closed your connection, Its important to close your database connection once you are done using it. Preferably put the call to close() inside a finally block, so that your database connection is closed irrespective of whether an SQLException was thrown during your query execution etc.
  2. In the catch block where you have caught your SQLException always print / log the SQL State by calling e.getSQLState(), by comparing the SQL State with your DBMS vendor data example here, you can map out exactly why your query failed.
peter_budo commented: Well spotted +16
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

@blackcompe

Teach a person to fish, do not give him the fish, thats the purpose of this forum, You should have at least let the O.P. attempt to use and understand the TreeMap collection on his own, and then help him with his solution, instead you have just given him the complete code to his assignment, and all he has to do is cut paste it without any need for understanding a thing !!!

Also I recall jasimp discouraging you from this practice, so why do you persist with it.

jasimp commented: Thanks for remembering :) +9
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

1.what is javadoc and how it works?

2.what Strong typing means?

My Answer :- STFW

3.if we want to control the input ,it is better to use exeption handeling (try chatch),or a single is to control the worng input,
whitch one is faster?

Exception Handling should be used for only handling "exceptional" situations. What you have mentioned can be done by performing appropriate validations on Input

catch(ArithmaticExeption a){
}
catch(IndexOutOfBoundsExeption a){
}

Yes its perfectly fine to have both variables named "a", because "a" is visible only inside the corresponding catch blocks and not outside of them. It wouldn't have killed you to just compile a program with the above situation, if it was incorrect at most you would have received a compile error.

serkan sendur commented: reputation is nothing -1
verruckt24 commented: What happen serkan sendur ? Giving bad rep to an o/w good post is basically misusing the power of it. I had to do this to counter off the effect. +3
Comatose commented: reputation is something +12
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

So answering to this thread would be just showcasing my Java skills as opposed to helping anyone ????

or

Is this a way of disguising your homework ??

or

Is this an assignment which you have copied from the NET and trying to get us to explain the code to ???

Well in the first case I do not have anytime for it and in the second case show us how much effort you put in tracing the execution path and for the third case forget about getting any help.

Salem commented: Works for me :) +29
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Using the showOptionDialog() from the JOptionPane class, you should be able to achieve that. As JOptionPane in the "showOptionDialog()"does allow you to add your own custom components.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

I need both the 'output' and 'enter' to be returned back to the calling method but one is a String and one is an int

You have many options here one is create a new class which has those two as its member properties and return a reference to this object from that method.
Second is put them both inside a "String" array of size "2" and return a reference to that array from the method and in the calling function extract the values from the array. For ex in the method you could have :-

String[] arrayOfValues = { output, Integer.toString(enter)};

And in the caller method you could extract the values from the "String" array as :-

output = arrayOfValues[0];
enter = Integer.parseInt(arrayOfValues[1]);

Next you could also return a Properties (or some other classes part of the Collections Framework ) object with the appropriate name value pairs mapped in it.

olgratefuldead commented: Very helpful +1
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

in C++ which will print the memory address of the someVar. then how we can do it in Java?

Why are you obsessed with printing memory addresses, when you can accomplish your linked list with "references" in Java.
<EDIT>

I willl just put a simple example here of how a simple node of a linked list can be implemented:-

class Node {
  int data;
  Node next;
}

Hopefully this will make it more clear. You can also check out this and this for some more explanation on how "references" are handled in Java.

Ezzaral commented: It will sink in eventually :) +18
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Hey, but wait!

Doesn't the do- while loop work in a way that it first executes the code and at the end evaluates the boolean? If the boolean is true it should go for another round, if false it should terminate. Right?

If this is correct then my boolean should be correct. If allocated would be smaller than c it would continue, else if equal it should stop?
Is this correct?

Eeep !!! Sorry Confused myself on that one, heres what I think is going wrong.
Now I just went through your code the problem seems to be a tad more deeper than I thought.

You see at the class level itself you have a member called allocated.

private int allocated;

Now let us look closely at your do-while loop.

do{
  int allocated = 0;
  for(int i = 0; ((allocated < c) && (i < n)); i++){
    this.road[i]=binaryGenerator();
    if(this.road[i]==1) {
      allocated = allocated +1;
    }
  }
  System.out.println("T "+ allocated +"  " + c);
} // This is where the scope of the "allocated" variable
  // declared inside the loop ends
while(allocated < c); // The allocated being referred to here is
                                // the one declared at the class level

Now inside you are manipulating the variable "allocated" which is declared inside the do-while block and it is this variables variable that is printed in your System.out.println("T "+ allocated +" " + c); , However thats where the scope of this "allocated" variable ends. In the …

Ezzaral commented: helpful +17
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

This is more of a core java question, So it should have been posted in the Java forum.
Anyways take a look at the javadocs of the String and StringBuffer class you might find what you are looking for there, most probably it is the substring (1,2) menthod..

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Tomcat by default doesn't have support for JSF (amd definitely Tomcat 5.5 doesn't),
Are you sure the new place has the JSF libraries because the following suggests the JSF libraries are mssing.

java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener

Also have never seen as yet anyone use JSF with a Tomcat version prior to 6.0.

peter_budo commented: Good tip +14
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Well to calculate days I would prefer a more simpler method like this :-

// Current day would store the index of the day in the Array
// 0 points to Sunday.

int currentDay = 0 
String days = {"Sun", "Mon", "Tue", "Wed", "Thr",  "Fri", "Sat" };

// Now if you want the day 10 days 
// after current day just do

String afterNextTenDays = days[(currentDay + 10) % 7];

String nextDay =  days[(currentDay + 1) % 7];

Similarly you can go on for all your combinations.
Also it is not exactly foolproof, you will need to take into account the special case when the currentDay is Sunday (and so set to 0) and the User asks for the previous day. In that case the formula in the square bracket would become [(7-(currentDay - noOfDays)%7)%7], this formula would be needed whenever you want to calculate a previous day. Looks kind off complicated but I guess there should be an easier way.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Well I see that you have specified a line segment to have two end points.
Now to check if lines are collinear you will have to get their equations and solve them simultaneously.
Now the equation of a line with slope "m" and with point (x1,y1) on it is given by :-
y = m(x-x1) + y1
You will need to define data members in your LineSegment class to store this information.
Once you have got the equations for all your line segments, to figure out if they are collinear or just intersecting you will have to solve the equation of any two of the line simultaneously.
For example consider we have three lines with the equations:-

Line 1: 3x + 4y = 3
Line 2: 2x - 2y = 7
Line 3: 9x -y = 0

You will need to solve any two of the equations simultaneously, to find the intersection points of the lines. That is if you solve the equations of Line 2 and Line 3 simultaneously you will get the intersection point of Line 2 and Line 3.
Next if you solve the equation of Line 1 and Line 3 simultaneously you will get the intersection point of Line 1 and Line 3.

If the intersection points in both the cases (Line 2 & 3 and Line 1 & 3) are both the same, then it means that the three lines are collinear and …

oldSoftDev commented: Awesome explanation +2
verruckt24 commented: That's a good bit of work in there. I thought of anwering this, but then couldn't find the time recollecting facts about lines. Keep it up. +2
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Now I am going to make some assumptions here on your merge method, My main assumption is if your method is called as arr2.merge( arr1 , arr); then you want the contents of arr1 and arr merged and in sorted order inside arr2.

Now if thats the case, why don't you parse the contents of "arr1" and "arr" separately and insert them into arr3 by calling arr3's insert() method, and as long as you are sure your insert method works fine, so will the merge method.

What I meant was something like this:-

public  void merge(OrdArray arr, OrdArray arr1)  {
  for(int i=0;i<arr.nElems<i++) {
    insert(arr.a[i]);
  }
 // Repeat similarly for the next object arr1
. .
. .
}

So as long as your insert() method works fine, your merge() method should not have issues.
Also a suggestion is refer to Sun Java Code Conventions, at least more important parts related to conventions for indenting and naming variables and methods.

Also you need to improve your skills in Object Oriented Programming, since in the program you are violating the principle of Encapsulation by making your member variables public. Your member variables should be private and in case you need to access them inside a different class implement the appropriate getter and setter methods that control access to these variables in an organized manner.

notuserfriendly commented: Very nice and simple implementation +3
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Now assuming your File format is of the type :-

Albert Einstein 0
Stephen Hawking 3

You would need to add the following lines of code in your while loop before reading the grades like :-

.
.
firstName = inFile.next();
lastName = inFile.next();
num = inFile.nextInt();
.
.
.

Note:-
Haven't tested the code but I guess thats how it should work.
You should refer to the javadocs of the Scanner class for more details.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

You will need to use a nested for loop if you want to print fixed number of characters horizontally also.

Following is how you loop would look like (note it is just for an illustration, you may have to modify it further to get what you exactly want) :-

final int noOfCharsPerLine = 10;
    for (int i = 128; i < 256; i++){
        for(int j=0; j< noOfCharsPerLine;i++,j++) {
            // Note the use of only "System.out.print"
	    System.out.print(i + " - " + (char)i + " ");
        }
        // To print on the next line after the 10 characters
        // have been printed.
        System.out.println();
    }

You will similarly have to modify your first loop.

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Actually to convert from .doc to .pdf via Java I could not find a direct method, But I found a two step process,

  1. Access your Microsoft Format files using Apache POI, You can read more about it here.
  2. Next use iText to convert the data you have into a PDF.
verruckt24 commented: I missed the first step ;) +2
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

Insert all the Strings that the user enters in to the args[] string array, since this array is being passed to each successive call of main, So you will have a list of all entered keywords in this array.

In order to check for repetitions just check if the entered word is present in the args[] array.

But instead of calling the main recursively I recommend you delegate this responsibility to some other method and let that method call itself recursively.

VernonDozier commented: Good point on the recursive calls. +11
stephen84s 550 Nearly a Posting Virtuoso Featured Poster
System.out.print(iterator.next() + " ");

The above code is your problem. Here you are printing the object and not its contents, hence the reason for getting those strange values in your output.
The reason is because you see the above code is exactly like :-

System.out.print(iterator.next().toString() + " ");

And by default the toSring() method of the Object (the super class of all objects in Java) class is called which prints that stuff.

What I suggest is that in our Kontakt class override the method "toString()" method and return a properly formatted String which you would displayed whenever anyone made such a call on the Kontakt class.

An example would be like:-

public class Kontakt {
.
.
.
.
  public String toString() {
    return "Name : " + name + " Surname : " + surname + 
        " Number : " + number;
}

Note above code is just for illustration, I haven't compiled it or anything.

BTW use [code=java] [/code] to envelop your code. That way it will also provide syntax highlighting also.

Ezzaral commented: Helpful. +15
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

My advice would be to confirm that really the file cannot be found. Take a look at the javadocs of File class. It has an "exists()" method using which you can really confirm whether the file can be read by your Java program or not.
If the "exists()" method returns false thens its confirmed that your code cannot reach the XML file but if ii returns true then I guess you have to check your XML file.
Now in case it returns false, you could try moving the xml file inside the folder which holds the your Eclipse Project (not the workspace, project folder is inside the workspace) and use just the relative path (i.e "blank.xml" if it is placed directly inside the project folder).

Also keep in mind the case of the filename in Java. Although I cannot confirm it since I am mostly on Linux, *I think* Java is case sensitive about file / folder names even though Windows is not, so also try renaming your file to all lower case and do the same while accessing it from your program to see if it works.

Hope it helps.

Tyster commented: Many Thanks for your help! +2
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

It is what it is supposed to be.

Do all Tigers have stripes ?

stephen84s 550 Nearly a Posting Virtuoso Featured Poster

India here.

~s.o.s~ commented: Better late than never, eh? ;-) +25
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

CEO my foot, am pretty sure you are just lone programmer cum administrator cum janitor there.
And hope your so called firm goes bankrupt and rots in HELL.

Salem commented: Good post +23
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

558

anupam_smart commented: nice signature +3
stephen84s 550 Nearly a Posting Virtuoso Featured Poster

If you want to use the HTTP API the it is pretty straight forward, you will need to use the java.net.URL and java.net.URLConnection classes in Java.

Here is a Java tutorial on how to work with URLs.
http://java.sun.com/docs/books/tutorial/networking/urls/index.html

Also following is an example illustrating how to perform HTTP POST in Java.
http://www.exampledepot.com/egs/java.net/Post.html

For SMPP however there is no in built support in Java, so you will need to find one of third party libraries. OpenSMPP is one such library. You will need to download the source code and build it using ant. Once you buid it using "ant", you will get the "smpp.jar" in the dist folder, the smpp.jar needs to be present in the classpath while you are compiling any projects which will be using OpenSMPP . Also the javadocs for it will be generated in the "doc" folder, the javadocs contain a few examples on how to connect to an SMPP service provider to send messages / receive messages.

Ezzaral commented: Good info. +15