lesson 1 Easy Java Program , Input using Scanner , and output statement java , NetBeans 8.2

Pubblicato il: 04 maggio 2020
sul canale di: LEARNSKILLS
1,465
14

lesson 1 Easy Java Program , The lesson will discuss about getting Input using Scanner , and output statement i java , NetBeans 8.2 . t
Detailed , explanation per line of source code , with complete source code included in the descriptions.
#java
#input
#scanner
#output
#mathoperators
Steps and procedures in Writing this Program using Scanner input reader , and output statement in java :
1) List the variables and class required Scanner input reader
2) Input name a String type data
3) Input age , integer type data
4) Display name and age as output
Please see the complete source code below :
import java.io.*; // library required for scanner input output functions
import java.util.Scanner; // library required for scanner input reader
public class InputOutput {

public static void main(String args [])
{
// list of variables
String name ; // String type stores text , characters and numbers
int age; // int store whole numbers
Scanner in = new Scanner(System.in).useDelimiter("\n"); // Scanner input reader method , useDelimeter means it will read input until next line

// input name
System.out.print("Enter your name :");
//read users input and store to variable
name=in.nextLine(); //nextLine() read and store String input

//input name
System.out.print("Enter your age :"); //print means to display the next statement on the same line
//read users input and store to variable
age=in.nextInt(); // nextInt(); read and store Integer

//Display the result

System.out.println( "Welcome " +name); // println means to display the next statement of the next line
System.out.println("You are " +age + " years old ");

}

}


In questa pagina del sito puoi guardare il video online lesson 1 Easy Java Program , Input using Scanner , and output statement java , NetBeans 8.2 della durata di ore minuti seconda in buona qualità , che l'utente ha caricato LEARNSKILLS 04 maggio 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,465 volte e gli è piaciuto 14 spettatori. Buona visione!