swing - java WordGame program -
i totally beginner. project school. need know, can tell me why won't run ?
import javax.swing.joptionpane; public class wordgame { public static void main(string[] args) { string name; name= joptionpane.showinputdialog("enter name"); string age; age= joptionpane.showinputdialog("enter age"); string city; city= joptionpane.showinputdialog("enter name of city"); string college; college= joptionpane.showinputdialog("enter name of college"); string profession; profession= joptionpane.showinputdialog("enter profession"); string animal; animal= joptionpane.showinputdialog("enter type of animal"); string pet; pet= joptionpane.showinputdialog("enter pet name"); string str="there once person named "+ name+ " \n lived in city. @ age of "+age+ ", "+ name +" went college @ \n"+ college+" ."+ name +" graduated , went work \n"+profession+" . then, "+ name +" adopted a(n) "+ animal +" \n named "+ pet+ ". both lived happily ever after!"; joptionpane.showmessagedialog(null, str); } }
considering have jre/jdk installed on system
create file named "wordgame.java
" put in directory d:/test
now go command prompt , run javac wordgame.java
compile code , generate class file
now run set class_path=.
temporary setting current directory classpath
and run java wordgame
, there go.. want
Comments
Post a Comment