John Delmark Aguilar

Delmark - Profiling
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 BufferedReader Syntax

View previous topic View next topic Go down 
AuthorMessage
dElmARk
Admin
Admin
avatar

Posts : 92
Join date : 09/04/2012

PostSubject: BufferedReader Syntax   Tue Oct 23, 2012 1: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
View user profile http://delmark.meabout.com
dElmARk
Admin
Admin
avatar

Posts : 92
Join date : 09/04/2012

PostSubject: Re: BufferedReader Syntax   Tue Oct 23, 2012 1: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
View user profile http://delmark.meabout.com
 
BufferedReader Syntax
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
John Delmark Aguilar :: dElmARk Productions :: Java Programs :: Tutorials-
Jump to: