Elite Coders Society
Hello Guest!
Join us here in this forum!
Please Log in or Register to access more feature in this site.
Start Learning!

† Copyright © 2011 - EliteCoders.forums.ag †


Start sharing and learning new skills about programming and design by building connections with other professional and students.
 
HomeForumPortalCalendarGallerySearchRegisterLog in
Elite Coders Partner Links

EliteCoders™ News!
Hello Guest!, Welcome in our forum. Be active!

Share | 
 

  Displaying Syntax System.out.print

View previous topic View next topic Go down 
AuthorMessage
avatar
Admin[dElmARk]
Forum Owner
Forum Owner

Posts : 78
EC-Points : 6304
Thanked : 21
Join date : 15/10/2011
Age : 22
Location : Philippines

Hacker's Info
Hacking Exp:
0/0  (0/0)
Hacker Type: White Hat
Hacking Title:

PostSubject: 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

______________________________________
[You must be registered and logged in to see this image.]
[You must be registered and logged in to see this image.]


Last edited by Admin[dElmARk] on Fri Nov 18, 2011 5:15 pm; edited 1 time in total
Back to top Go down
View user profile
avatar
Admin[dElmARk]
Forum Owner
Forum Owner

Posts : 78
EC-Points : 6304
Thanked : 21
Join date : 15/10/2011
Age : 22
Location : Philippines

Hacker's Info
Hacking Exp:
0/0  (0/0)
Hacker Type: White Hat
Hacking Title:

PostSubject: 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.]

______________________________________
[You must be registered and logged in to see this image.]
[You must be registered and logged in to see this image.]
Back to top Go down
View user profile
avatar
Admin[dElmARk]
Forum Owner
Forum Owner

Posts : 78
EC-Points : 6304
Thanked : 21
Join date : 15/10/2011
Age : 22
Location : Philippines

Hacker's Info
Hacking Exp:
0/0  (0/0)
Hacker Type: White Hat
Hacking Title:

PostSubject: 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.

______________________________________
[You must be registered and logged in to see this image.]
[You must be registered and logged in to see this image.]
Back to top Go down
View user profile

Sponsored content



PostSubject: Re: Displaying Syntax System.out.print   

Back to top Go down
 

Displaying Syntax System.out.print

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Elite Coders Society :: Software Development :: Java Programming :: Java Programming-

Protected by Copyscape Duplicate Content Finder
Powered By EliteCoders™

Elite Coders Partner Links
GreyPhantomYour Link HereYour Link HereYour Link Here
Yahoo!GoogleFacebookForumotion