Class-3, Java - Scanner Class and user input program (14/2/2023)

preview_player
Показать описание
If u want to get the input from the console then u need to create a memory of Scanner class.
Scanner is a class that is already defined in java. Scanner have multiples methods like-
nextInt()- to get the input for int type
nextFloat() - decimal
next() - string
nextLong()- long
next().charAt(); character

----------------------------------Example Program------------------
package javaprograms;

public class Addition_demo
{

public static void main(String[] args)
{

int c=a+b;

}



}
Рекомендации по теме
visit shbcf.ru