John Delmark Aguilar
Would you like to react to this message? Create an account in a few clicks or log in to continue.
John Delmark Aguilar

Personal Forum
 
HomeSearchLatest imagesRegisterLog in

 

 BufferedReader Syntax

Go down 
AuthorMessage
dElmARk
Admin
Admin
dElmARk


Posts : 92
Join date : 09/04/2012

BufferedReader Syntax Empty
PostSubject: BufferedReader Syntax   BufferedReader Syntax Icon_minitimeTue Oct 23, 2012 8:43 pm

BufferedReader Syntax.

The program starts with the code import java.io.*; before the class name, but must be inside the method


Code:

import java.io.*;
class progName {
      public static void main(String[] args){
      BufferedReader brVarName = new BufferedReader(new InputStreamReader(System.in))throws Exception;
    }
 }

Back to top Go down
https://delmark.forumtl.com
dElmARk
Admin
Admin
dElmARk


Posts : 92
Join date : 09/04/2012

BufferedReader Syntax Empty
PostSubject: Re: BufferedReader Syntax   BufferedReader Syntax Icon_minitimeTue Oct 23, 2012 8:44 pm

Declaring variable together with its data type using BufferedReader.
(Continued..)

Via Input Data
Code:
String stringVar = brVarName.readLine();
char charVar = brVarName.readLine();
int intVar = Integer.parseInt(brVarName.readLine());
Double doubleVar = Double.parseDouble(brVarName.readLine());
Fload floatVar = Float.parseFloat(brVarName.readLine());

User Defined Declaration
Code:

String stringVar = "Text Message, Sencence or Paragraph";
char charVar = 'a'; || char charVar = '1';
int intVar = 12;
Double doubleVar = 100.0;
Fload floatVar = 50.0;


__________

Take a look at this:

Code:

import java.io.*;
class Sample{
    public static void main(String []args)throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    System.out.print("Input Name: ");
    String name = br.readLine();
    System.out.print("Input a letter or a number: ");
    char character = br.readLine();
    System.out.print("Input your age: ");
    int age = Integer.parseInt(br.readLine());
    System.out.print("Input a number with decimal: ");
    Double Doubledecimal = Double.parseDouble(br.readLine());
    System.out.print("Input a number with decimal: ");
    Fload Floatdecimal = Float.parseFloat(br.readLine());
    }
}

Back to top Go down
https://delmark.forumtl.com
 
BufferedReader Syntax
Back to top 
Page 1 of 1
 Similar topics
-
» Scanner Syntax
» Displaying Syntax System.out.print

Permissions in this forum:You cannot reply to topics in this forum
John Delmark Aguilar :: dElmARk Productions :: Java Programs :: Tutorials-
Jump to: