Computer Science, asked by Smartboy00102, 1 year ago

In which package is scanner class included

Answers

Answered by Rajdeep11111
1
Hi there...
Rajdeep here!
Scanner class is included in package :
java.util


A package is a group of classes.
to include it in a class, write the following code:

import java.util.*
Answered by siddhartharao77
1
Scanner is a class in java.util.package.

Example:

import java.util.Scanner;

class Add
{
public static void main(String args[])
{
int a,b,c;

System.out.print("Enter 1st number: ");

Scanner scan = new Scanner(System.in);

a = scan.nextInt();

System.out.println("Enter 2nd number: ");

b = scan.nextInt();

c = a + b;

System.out.println("The output is:" +c);

}

}


Hope this helps!
Similar questions