Write a java program to input student details and display the same in the following format
Name - XYZ
Roll No - 32
class - 9
section - A
Height - 5'3
(using scanner class)
Answers
Answer:
import java.util.Scanner;
public class Hello{
public static void main(String []args){
Scanner sc=new Scanner(System.in);
System.out.println("Enter name");
String name=sc.nextLine();
System.out.println("Enter your roll no.");
int roll=sc.nextInt();
System.out.println("Enter your class");
int cl=sc.nextInt();
System.out.println("Enter section");
char sec=sc.next().c h a r A t (0);
System.out.println("Enter your height in feet and inches in consecutive lines");
int f=sc.nextInt();
int i=sc.nextInt();
System.out.println("Name - "+name);
System.out.println("Roll No. - "+roll);
System.out.println("Class - "+ clas);
System.out.println("Section - "+sec);
System.out.println("Height - "+f+"\""+i+"'");
}
}
Explanation:
Hope it helps :-)
There are four main computer hardware components that this blog post will cover: input devices, processing devices, output devices and memory (storage) devices. Collectively, these hardware components make up the computer system.