Sunday, August 30, 2020

Basic input output in java | java source file

package Newin;

import java.util.Scanner;


public class Newin

 {

    public static void main(String[] args)

     {

         //integer input

        Scanner sc=new Scanner(System.in);

        System.out.println("Enter some number:");

        int n =sc.nextInt();

        System.out.println("The Entered value is:");

        System.out.println(n);

        //character input

        Scanner sc1=new Scanner(System.in);

        System.out.println("Enter some String");

        String ch=sc1.nextLine();

        System.out.println("Entered String is:");

        System.out.println(ch);

    }

}

//Written by Eaglesoft programmers

No comments:

Post a Comment