Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Java Get float, double and String Input

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 text: ");
        String myString = input.next();
        System.out.println("Text entered = " + myString);
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: import claim jwt 
Java :: google intent for directions 
Java :: java pattern matching 
Java :: exmple of methods in java 
Java :: how to take input an array in java 
Java :: system program j 
Java :: MinimumAndMaximum 
Java :: Java Numbers and Strings 
Java :: Java Super Power java 
Java :: clear array in java 
Java :: com.google.firebase.database.DatabaseException: Serializing Arrays is not supported, please use Lists instead 
Java :: play default message ringtone android studio 
Java :: song listening app android 
Java :: java default constructor 
Java :: how to create a 2d arraylist java 
Java :: java importing 
Java :: okhttp3, android okhttp 
Java :: arduino convert byte array to string 
Java :: Java find duplicate items 
Java :: how to create a boolean list in java 
Java :: extract substring in string java 
Java :: Access HashMap Elements 
Java :: why is java so verbose 
Java :: get random word from xz file 
Sql :: stop mysql service ubuntu 
Sql :: cannot truncate a table referenced in a foreign key constraint 
Sql :: freemysqlhosting keeps deleting tables 
Sql :: restart the psql server windows 
Sql :: dbms output 
Sql :: mysql search for column name in all tables 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =