Professional Documents
Culture Documents
PRACTICAL – 1
AIM : Install JDK and write a java program to print your name.
You need to identify your system specifications to choose the Product/file description. The
website will contain the latest version for your corresponding system. For Windows, we’ll be
downloading the latest x64 Installer of Java SE Development Kit 18. After the download is
complete, proceed to install the JDK by following the bootstrapped steps.
Rakholiya Yash 1
Programming with Java (2030106406) Enrollment (2227010601212)
To set the Environment Variables, you need to search Environment Variables in the Task Bar and
click on“Edit the system environment variables”.
Rakholiya Yash 2
Programming with Java (2030106406) Enrollment (2227010601212)
Under System variables, select the “Path” variable and click on “Edit”. Click on “New” then paste
the Path Address i.e. C:\Program Files\Java\jdk-{YOUR_JDK_VERSION} \bin. Click on “OK”.
Now, in the Environment Variables dialogue, under System variables, click on “New” and then
under Variable name: JAVA_HOME and Variable value: paste address i.e. C:\Program
Files\Java\jdk-
{YOUR_JDK_VERSION}. Click on OK => OK => OK.
Rakholiya Yash 3
Programming with Java (2030106406) Enrollment (2227010601212)
code
public class name {
public static void main(String[] args) {
System.out.println("My name is Rakholiya Yash ");
}
}
Output
Rakholiya Yash 4
Programming with Java (2030106406) Enrollment (2227010601212)
PRACTICAL – 2
AIM : create three variables to store marks of three subject and generate mark
sheet .(use if condition or switch case)
Rakholiya Yash 5
Programming with Java (2030106406) Enrollment (2227010601212)
PRACTICAL – 3
AIM :write a program in java to reverse the digits of a number using while loop .
code
public class ReverseNumber
{
public static void main (String[] args)
{
int number =845743,reverse=0;
while(number !=0)
{
int remainder=number %10;
reverse=reverse * 10 + remainder;
number=number/10;
}
System.out.println("the reverse of the given number is :" + reverse);
}
}
Output
Rakholiya Yash 6
Programming with Java (2030106406) Enrollment (2227010601212)
PRACTICAL – 4
AIM :write a program to demonstrate use of wrapper class .
code
public class Wrapper
{
public static void main(String args [])
{
byte b=10;
short s=20;
int i=30;
long l=40;
float f=50.0F;
double d=60.0D;
char c='a';
boolean b2=true;
Byte byteobj=b;
Short shortobj=s;
Integer intobj=i;
Long longobj=l;
Float floatobj=f;
Double doubleobj=d;
Character charobj=c;
Boolean boolobj=b2;
Rakholiya Yash 7
Programming with Java (2030106406) Enrollment (2227010601212)
byte bytevalue=byteobj;
short shortvalue=shortobj;
int intvalue=intobj;
long longvalue=longobj;
float floatvalue=floatobj;
double doublevalue=doubleobj;
char charvalue=charobj;
boolean boolvalue=boolobj;
Rakholiya Yash 8