Computer Science, asked by princeishaansingh, 11 months ago

write a program in java as per the given details:
class name:Myself
My name:...................................
Father's name:...............................
Postal address:...........................
Contact Number:........................
The program displays all the details on the output screen.

Answers

Answered by SerenaBochenek
6

Following are the program in java language which is given below :

Explanation:

import java.util.*; // import package  

public class Myself  

{

public static void main(String[] args) // main method

{

Scanner scrn2=new Scanner(System.in); // create the instance of scanner class

String myname; // variabe declaration

System.out.print(" Enter My name:");

myname=scrn2.nextLine(); // Read the name input by the user  

System.out.print(" Enter father's name:");

String fname=scrn2.nextLine();// Read the fathes name input by the user  

System.out.print("Enter Postal address:");

String postal=scrn2.nextLine();// Read the address input by the user

System.out.print("Enter the phone number:");

long number= scrn2. nextLong(); // Read the phone number

System.out.println("My name:" +myname); // display the name

System.out.println("father's name:" +fname);//// display the fathers name

System.out.println("Postal address:" +postal); //// display the address

System.out.println("Contact Number:" +number); //// display the phone number  

}

}

Output:

Enter My name: Manvi  Soni

Enter father's name: Mr. Suresh Soni

Enter Postal address: 56 Lalbangla

Enter the phone number:7898585978

My name: Manvi Soni

father's name: Mr. Suresh Soni

Postal address: 56 Lalbangla

Contact Number: 0987654321

The description of the program is given below:

  • Create the instance of scanner class
  • Read the name input by the user using nextLine() method
  • Read the father's name input by the user using nextLine() method
  • Read the address input by the user using nextLine() method
  • Read the name input by the user using nextLong() method

Finally print the value in the given format which is mention in the question.

Link below:

Wap a program in java...

https://brainly.in/question/6086565

Similar questions