This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Test Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Test Class" Watch "Test Class" New topic

Test Class

Rupinder Bains
Ranch Hand

Joined: Jul 23, 2002
Posts: 65
Hiya Everyone,
You all must know that I am useless at Java by now. :roll:
BUT... How do you test a class using a console display. BUT CANNOT inplement a GUI.
Thank You
Donald R. Cossitt
Ranch Hand

Joined: Jan 31, 2003
Posts: 401
The simplest way is from a command line in your DOS console make sure you change directory to the directory your class / java files are in then type: java whatevereFileName <enter>.
EG. C:\javaProjects\Testing> java myTestFile <enter>
Case is important.
Are you familiar with DOS 'cd' command?

subhit chauhan
Ranch Hand

Joined: Jun 20, 2002
Posts: 40
put system.out.println() where ever you want to debug you java class....
Francis Siu
Ranch Hand

Joined: Jan 04, 2003
Posts: 867
hi Rupinder
Which Operating System you use?
If you use Unix system, you can choose the console to display the statement which you use the System.out.println("") to print it out.
And I agree subhit that can use it to debug in some situations.
System.out.println("") default output is in console

Francis Siu
subhit chauhan
Ranch Hand

Joined: Jun 20, 2002
Posts: 40
For application prog. its command prompt in windows... but for applets its java console..
No idea about Unix
It is sorta covered in the JavaRanch Style Guide.
subject: Test Class
Similar Threads
Array Problem
JUnit question
SUN Java in windows environment questions..
non-static variable this cannot be referenced from a static context
A simple(!) "Call by Value "Example