write a java program to print your name and roll no. in the same line and class in next line
Answers
Answered by
2
Answer:
Explanation:
import java.util.Scanner;
class student
{
public static void main(String[]args)
{
Scanner in = new Scanner(System.in);
System.out.println("Enter your name");
String name = in.nextLine();
System.out.println("Enter your roll.no");
int roll_no = in.nextInt();
System.out.println("Enter your class");
int class = in.nextInt();
System.out.println("Name: " + name + "Roll.No: " + roll_no);
System.out.println("Class: " + class);
}
}
Hope this program helps you!!
Similar questions
Social Sciences,
4 months ago
English,
4 months ago
Physics,
9 months ago
English,
1 year ago
Math,
1 year ago