Post in Forums
Create a Profile
Upload Pictures
Make Polls
Keep a Journal
Meet Friends
Have Fun
It's FREE!
Sign Up!
Avoid the cold & the crowds - Buy your Christmas gifts at Amazon.com
Forum Index > Computers & Internet > Programming
>> Java
Reply to Topic
Search Topic
Subscription
Author Message
New Post! Nov 04, 2009 @ 13:28:38#1
tonkz

Über-Meister
2528 points


Send PM


18/M/Croydon, United Kingdom
Join Date: Aug 2007

i know this is proper simple java. It's only practise stuff for if statements with Joptionpane, but what puzzles me is why does the program compile when i'm using 'System.out.println' but does not compile when im using the 'JOptionPane.showMessageDialog'


For example (from code below)=
________________________________
if (input1.equals ("M")
{
JOptionPane.showMessageDialog("Monday"
}
________________________________
instead of the 'System.out.println("Monday" being where JOptionPane.showMessageDialog is (in code above)



Code as stands = compiles fine
_____________________________________
import javax.swing.JOptionPane;
public class DaysOfWeek
{
public static void main(String[] args)
{

String input1 = JOptionPane.showInputDialog("Enter your input" ) ;

if (input1.equals ("M")
{
System.out.println ("Monday" ) ;
}
else if (input1.equals ("Tu")
{
System.out.println ("Tuesday" ) ;
}
else if (input1.equals ("W")
{
System.out.println ("Wednesday" ) ;
}
else if (input1.equals ("Th")
{
System.out.println ("Thursday" ) ;
}
else if (input1.equals ("F")
{
System.out.println ("Friday" ) ;
}
else if (input1.equals ("Sa")
{
System.out.println ("Saturday" ) ;
}
else if (input1.equals ("Su")
{
System.out.println ("Sunday" ) ;
}
else
{
System.out.println ("Enter the shortcut codes 'M' 'Tu' etc" ) ;
}

}
}
_____________________

sorry about the faces LOL




I am a firm believer that the amount of money and material possessions you own dictates the amount of sex you will recieve.
On November 21, 2009
Edited: November 04, 2009 @ 13:29
Reply to Topic<< Previous Topic | Next Topic >>

Top

TFS Time: Sun 22 Nov 2009 03:58 am CST
Copyright © 2004-2009 Funky Llama Productions, LLC   |   Home   |   Contact   |   Privacy Policy   |   Terms of service

The Forum Site - Your premier source for everything LOGIN REGISTER