1. Write a Java program 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
7
This is a very easy Question....Here is an approach
Code:-
class Myself
{
static void main(String s[])
{
String myName="Abcd";
String fathersName="Abcd's father";
String postalAddress="Abcd's postal address";
int contactNum=9876543210;
System.out.println("My name is: "+myName);
System.out.println("My father's name is: "+fathersName);
System.out.println("Postal Address: "+postalAddress);
System.out.println("Contact Num: "+contactNum);
}
}
Variable Description:-
- myName:- To store User's name.
- fathersName:- To store User's father's name.
- postalAddress:- To store User's address.
- contactNum:- To store contact number of the user.
Similar questions