Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
38 views

Java Input Output Program

This Java code uses the Scanner class to take user input of different data types including float, double, and strings. It prompts the user to enter values of each type, stores them in variables, and prints out the values that were entered.

Uploaded by

Aricfk Th
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Java Input Output Program

This Java code uses the Scanner class to take user input of different data types including float, double, and strings. It prompts the user to enter values of each type, stores them in variables, and prints out the values that were entered.

Uploaded by

Aricfk Th
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Import java.util.

Scanner;

Class Input {

Public static void main(String[] args) {

Scanner input = new Scanner(System.in);

// Getting float input

System.out.print(“Enter float: “);

Float myFloat = input.nextFloat();

System.out.println(“Float entered = “ + myFloat);

// Getting double input

System.out.print(“Enter double: “);

Double myDouble = input.nextDouble();

System.out.println(“Double entered = “ + myDouble);

// Getting String input

System.out.print(“Enter Your name: “);

String myString = input.next();

System.out.print(“Enter Your Class: “);

String String = input.next();

System.out.print(“Enter Your Rollno: “);

String rString = input.next();

System.out.print(“Enter Your name: “);

String mString = input.next();

System.out.println(“Text entered = “ + myString);

System.out.println(“Text entered = “ + rString);

System.out.println(“Text entered = “ + mString);

You might also like