wap in java to display your details
Answers
Greetings..!
class details
{
public static void main(String args[])
{
System.out.println("My name is John");
System.out.println("I am 22 years old and I live in California,USA.");
System.out.println("I study in the Imperial Engenieering university ");
}
—› Details include:
- Name
- Class
- Sec
- Roll no
- School name
Since, it's not mentioned in the question, so I am giving the basic details in the program :-
—› Your Program:
//java program to display your details
import java.util.*;
public class details
{
public static void main (String args [] )
{
Scanner in = new Scanner(System.in); //using scanner class to take input from the user
int c, r;
char s;
String n, sn;
System.out.println("Enter your name,class,sec,roll no and school name :");
n = in.nextLine();
c = in.nextInt();
s = in.nextCharAt();
r = in.nextInt();
sn = in.nextLine();
System.out.println("Your Details: ");
System.out.println("Name :-" +n);
System.out.println("Class :-" +c);
System.out.println("Section :-" +s);
System.out.println("Roll no :-" +r);
System.out.println("School name :-" +sn);
}
}
—› Output:
Enter your name,class,sec,roll no and school name :
Aarti Singh
10
D
31
H.P Vidya Bharti High School
Your Details:
Name :- Aarti Singh
Class :- 10
Section :- D
Roll no :- 31
School name :- H.P Vidya Bharti High School
--------------------------