Results 1 to 6 of 6
Thread: System.out.prntln
- 05-26-2011, 10:34 AM #1
Newbies
- Join Date
- May 2011
- Posts
- 5
- Rep Power
- 0
- 05-26-2011, 11:50 AM #2
Member
- Join Date
- May 2011
- Location
- Herentals, Belgium
- Posts
- 14
- Rep Power
- 0
System.out.println("\nArea"+area); :
The \n is an escape character, this will print an "empty" line first. the rest will be printed on the next line. "\nArea" is a string (ignore the \n), so ist quite obvious that this wil be printed to screen the way you see it.
The +area part: the + means you want to add something after the "\nArea", the thing that will bee added will be whatever is in the area-variable.
f.i: int area = 32 , this will get you the output "Area32" (note that it will be pasted right after the string so if you want "Area 32" you wil need to type: System.out.prinln("\nArea "+area); (note the extra space after "Area".
Also the ln in println makes the cursor go to a new line after it has printed its contents
You got any help from this? I know I sck at explaining things...
PeaceEnjoy your milk!! :cool:
- 05-26-2011, 11:53 AM #3
Member
- Join Date
- May 2011
- Location
- Herentals, Belgium
- Posts
- 14
- Rep Power
- 0
Static means that you do not have to initialize your class before you can use the method.
String[] args is an array of strings, which you can fill before you run your program. For example, if you use the command line to run your program : java MainProgram , this will let you run the program with an empty args array. If you use java MainProgram hello, the first element og the args array will be "hello"...
PeaceEnjoy your milk!! :cool:
- 05-26-2011, 01:03 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
- 05-26-2011, 02:19 PM #5
Newbies
- Join Date
- May 2011
- Posts
- 5
- Rep Power
- 0
my problem was with "+".now got the answer.thanks for ur interest
- 05-26-2011, 02:20 PM #6
Newbies
- Join Date
- May 2011
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
Java System
By janz_23 in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 10-05-2010, 01:21 PM -
System Tray
By 67726e in forum AWT / SwingReplies: 8Last Post: 08-12-2010, 04:21 PM -
Convert Cartesian coordinate system into java coordinate system?
By 123 in forum Java 2DReplies: 3Last Post: 02-07-2010, 08:34 PM -
System Tray
By JavaLerner in forum New To JavaReplies: 2Last Post: 07-13-2008, 08:25 AM -
Password System help
By quickfingers in forum New To JavaReplies: 1Last Post: 06-23-2008, 06:18 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks