Friday, July 31, 2009

My java program runs but will not give an output! Urgent help needed!?

I am using JCreator as IDE for my Java programs in Programming Fundamentals. My problem is, the process is completed yet the desired output is not displayed. Our instructor doesn't help much on this matter. I dug the internet but examples given were all integers and strings and not cahracters.We are ask to make a program that determines the class of a ship depending on a code entered.


B or b = Battleship


C or C = Cruiser


D or d = destroyer


G or g = Gunboat


other = Invalid code


.. the output is by using JOptionPane.

My java program runs but will not give an output! Urgent help needed!?
Modify your question with the code. But I suggest you two option.


1. If you are using console input/output you command line compilation/run with the help DOS Prompt.





2. If you are using Windows input/output you can use appletviewer supplied by the JDK.





I also guess that your code would be like this











if(choice==B||choice==b)


{


System.out.println("BattleShip");


}


if(choice==C || choice==c)


{


System.out.println("Cruiser");


}








and if you are using something like above


than use





javac to compile


java to run





Reply me if problem is solved or not
Reply:It's really hard to fix a programming problem without seeing the code. Can you post it?
Reply:use java update


No comments:

Post a Comment