Thread: JAVA and J2EE
View Single Post
  #4 (permalink)  
Old 11-29-2007, 06:31 AM
Eranga's Avatar
Eranga Eranga is offline
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 4,412
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by rgbosque View Post
then what should i learn first as a newbie on this language?
You should learn standard Java concepts first, that is J2SE(Standard Edition). Lots of books also available, I'm Sam's publication user. If you can find this book.

Sams Teach Yourself Java in 21 Days

Excellent book for beginners, I told you in my experience.



Quote:
Originally Posted by rgbosque View Post
Additional:
if i run this simple code of "if then statement" the name Variable is not returning TRUE if i entered a "RODEL". Is "if then statement" is only for numbers?
Thanks in advance...

This is a code:
import javax.swing.JOptionPane;

class DialogBox {
public static void main(String[] args) {

JFrame frame = new JFrame();

String name = JOptionPane.showInputDialog("What is your name:");

if (name == "Rodel") {
JOptionPane.showMessageDialog(frame,"You are " + name);
}
else {
JOptionPane.showMessageDialog(frame,"I Dont Recognize Your Name");
}


}
}
I'll try to explain in simple words as much as possible. Simply for your question, the answer is NO. name is a String type variable. If the variable is Rodel, output is "You are Rodel". It gives on the "if" condition.

If not in "else" condition, your output is "I Dont Recognize Your Name". In this case if-else is not for numbers, for String, that is sequence of characters(letters, numbers, etc..)

JFrame and stuff are focusing on graphical format. You can learn those stuff in J2SE. In the code you have provide some errors. Try to find those later.

Hope it is clear to you.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Reply With Quote