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 †
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.
 
HomeForumBuffered Reader Syntax 2a512xyPortalLatest imagesGalleryBuffered Reader Syntax Dw6hztSearchBuffered Reader Syntax 2ns506pBuffered Reader Syntax 2dt2b75RegisterLog in
Elite Coders Partner Links

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

Share | 
 

 Buffered Reader Syntax

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

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

Hacker's Info
Hacking Exp:
Buffered Reader Syntax Left_bar_bleue0/0Buffered Reader Syntax Empty_bar_bleue  (0/0)
Hacker Type: White Hat
Hacking Title:

Buffered Reader Syntax Empty
PostSubject: Buffered Reader Syntax   Buffered Reader Syntax EmptySun Oct 16, 2011 4:35 am

Buffered Reader Syntax

Code:

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

Program Sample:


import java.io.*;
class Pname{
public static void main(String [] args)throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("[Message]");
String Svar = br.readLine();
System.out.println("[Message]");
}
}


______________
Note:
If you put "String Svar = br.readLine();" it means that you are declaring the variable when you input the content.
Back to top Go down
Admin[dElmARk]
Admin[dElmARk]
Forum Owner
Forum Owner

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

Hacker's Info
Hacking Exp:
Buffered Reader Syntax Left_bar_bleue0/0Buffered Reader Syntax Empty_bar_bleue  (0/0)
Hacker Type: White Hat
Hacking Title:

Buffered Reader Syntax Empty
PostSubject: Re: Buffered Reader Syntax   Buffered Reader Syntax EmptySun Oct 16, 2011 4:08 pm

Activity BufferedReader.


Create a program where the computer will interact with the user.
Ask for the following.
(a) The full name of the user.
Computer’s reply: How are you (name of the user).
(b) The favorite food of the user.
Computer’s reply: We have the same favorite….
(c) The favorite movie of the user.
Computer’s reply: I don’t like that.
__________


Program Code:

import java.io.*;
class Activity{
public static void main(String [] args)throws Exception{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("What is your name: ");
String Name"How are you " + Name);
System.out.print("What is your favorite food: ");
String FavFood =br .readLine();
System.out.println("We have the same favorite, " + FavFood);
System.out.print("What is your favorite movie: ");
String FavMovie = br .readLine();
System.out.println("I don't like that, " + FavMovie);

}
}




Sample Output:


What is your name: User
How are you User
What is your favorite food: Rice
We have the same favorite, Rice
What is your favorite movie: Iron Man
I don’t like that, Iron Man

Back to top Go down
 

Buffered Reader Syntax

View previous topic View next topic Back to top 

 Similar topics

-
» BufferedReader Syntax
» Scanner Syntax
» Syntax for a Java Program
» Java Basic Syntax (E-Book)
» Java Basic Syntax (E-Book)
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Elite Coders Society :: Lobby/Social :: Basket-

Protected by Copyscape Duplicate Content Finder
Powered By EliteCoders™

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