Admin[dElmARk] Forum Owner
Posts : 78 EC-Points : 6304 Thanked : 21 Join date : 15/10/2011 Age : 29 Location : Philippines
Hacker's Info Hacking Exp: (0/0) Hacker Type: White Hat Hacking Title:
| Subject: Displaying Syntax System.out.print Sun Oct 16, 2011 4:09 am | |
| Statements Sample
Displaying Syntax
Code: System.out.print(“[Message]”); System.out.print(“[Message]”);
Output: [Message][Message]
Code: System.out.println(“[Message]”); System.out.println(“[Message]”);
Output: [Message] [Message]
The difference of print and println print - displays the content on the same line println - displays the content on the next line
Last edited by Admin[dElmARk] on Fri Nov 18, 2011 5:15 pm; edited 1 time in total |
|
Admin[dElmARk] Forum Owner
Posts : 78 EC-Points : 6304 Thanked : 21 Join date : 15/10/2011 Age : 29 Location : Philippines
Hacker's Info Hacking Exp: (0/0) Hacker Type: White Hat Hacking Title:
| Subject: Re: Displaying Syntax System.out.print Sun Oct 16, 2011 4:27 am | |
| Create a sample program: Code: class Pname{ public static void main(String [] args){ System.out.println(" [Message]"); System.out.println(" [Message]"); } } _____________ Save as Pname.java Compiling and Running 1. Start then Run. 2. Type cmd (Press enter). 3. Go to the drive of your folder. Ex: c: (Press enter) 4. Compile your program. Ex: c Pname.java (Press enter). 5. Run the program. Ex. r Pname (Press enter). Note: The 4 and 5 are your batch files Link: [You must be registered and logged in to see this link.] |
|
Admin[dElmARk] Forum Owner
Posts : 78 EC-Points : 6304 Thanked : 21 Join date : 15/10/2011 Age : 29 Location : Philippines
Hacker's Info Hacking Exp: (0/0) Hacker Type: White Hat Hacking Title:
| Subject: Re: Displaying Syntax System.out.print Fri Nov 18, 2011 5:23 pm | |
| Displaying Variable
Code:
VarType varName = content; System.out.print(varname);
Sample: String name = "Your name"; System.out.print(name);
Output: Your name
________________ Displaying morethan one variable/message.
Sample: Sting name = "Juan"; int age = 16; System.out.print("Name: " + name + "Age: " + age);
Output: Name: Juan Age: 16
Note: You must use the plus sign(+) to add the variable and use two double quote ("") in displaying a message. |
|
Sponsored content
| Subject: Re: Displaying Syntax System.out.print | |
| |
|