John Delmark Aguilar

Delmark - Profiling
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Introduction to Java Programming [Power Point]

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

Posts : 92
Join date : 09/04/2012

PostSubject: Introduction to Java Programming [Power Point]   Sun Oct 21, 2012 10:31 am



Introduction to Java Programming








Slide 34 Note:
Code:

import java.io.*;
import java.util.*;
class inputOutput{
    public static void main(String []args){
    BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
    Scanner scnr = new Scanner(System.in);
    // String input
    System.out.print("What is your name: ");
    String name1 = br.readLine();
    System.out.print("What is your name: ");
    String name2 = scnr.nextLine();
   
    // Int input
    System.out.print("What is your age: ");
    int age1 = Integer.parseInt(br.readLine());
    System.out.print("What is your age: ");
    int age2 = scnr.nextInt();

    // double input
    System.out.print("What is your Grade: ");
    double grade1 = Double.parseDouble(System.in());
    System.out.print("What is your Grade: ");
    double grade2 = scnr.nextDouble();

    System.out.println("Buffered Reader inputs.");
    System.out.println("Your name is " + name1);
    System.out.println("Your age is " + age1);
    System.out.println("Your grade is " + grade1);
    System.out.println("\nScanner inputs");
    System.out.println("Your name is " + name2);
    System.out.println("Your age is " + age2);
    System.out.println("Your grade is " + grade2);
    }
}

Back to top Go down
View user profile http://delmark.meabout.com
 
Introduction to Java Programming [Power Point]
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: