Oop Lab Manula
Oop Lab Manula
Oop Lab Manula
Lab: 01
Step-III:
Download JRE on given below website
Step-IV:
Show Download Process of JRE
Step-V:
Executing JRE on system
Show installing Process
Java:
Java is a general-purpose computer-programming language that is concurrent, class-
based, object-oriented, and specifically designed to have as few implementation
dependencies as possible.
Designed by
James Gosling
platform
Microsoft Windows
Latest reseal
Ada, C++, C#, Eiffel, Mesa, Modula-3, Oberon, Objective-C, UCSD Pascal, Object
Pascal
JDK
JDK. (Java Development Kit) A Java software development environment from Oracle. It
includes the JVM, compiler, debugger and other tools for developing Java applets and
applications.
Use of jdkThe APIs described here are those that are provided with the Oracle JDK. It
includes a complete implementation of the Java SE 11 Platform and additional Java APIs to
support developing, debugging, and monitoring Java applications.
Jvm
A JVM is a software-based machine that runs Java programs. ... However, the Java code from a
.JAVA file must first be converted into instructions the JVM can understand. This binary format,
called "bytecode," can be processed one instruction at a time or compiled into a .CLASS file
before execution to improve performance.
Uses of jvm
A Java Virtual Machine, or JVM, is a software virtual machine that runs compiled Java
code. Because compiled Java code is merely bytecode, the JVM is responsible for
compiling that bytecode to machine code before running it. (This is often called the Just
in Time Compiler or JIT Compiler.)
TASK #01
CODE:
class Hello{
System.out.println("Hello World");
LAB :02
TASK #01
CODE:
class Calculator{
System.out.println(a+b);
obj.add(15,16);
TASK #02
CODE:
class Calculator{
System.out.println(x+y);
return x+y;
obj.add1(15,16);
}
Compile and Run:
TASK #03
CODE:
class Test{
int i;
for(i=0;i<10;i++)
System.out.println(i);
TASK#04
CODE:
class Test{
int i=0;
while(i<10){
System.out.println(i);
i++;
TASK#05
CODE:
class Test{
int i=0;
do
System.out.println(i);
i++;
while(i<10);
}
LAB : 03
TASK#01
CODE:
class Car{
String name;
Car(){
name="By default";
Car(String name1){
name=name1;
System.out.println(c.name);
System.out.println(c1.name);
}
}
TASK#02
CODE:
class Student{
String name;
int roll_no;
int age;
double gpa;
String address;
Student(){
name="Misbah";
roll_no=76;
age=18;
gpa=4;
address="fjwu rawalpindi";
void read(){
System.out.println("read");
void write(){
System.out.println("write");
System.out.println("Name:"+obj.name);
System.out.println("Roll-no:"+obj.roll_no);
System.out.println("Age:"+obj.age);
System.out.println("GPA:"+obj.gpa);
System.out.println("Address:"+obj.address);
obj.read();
obj.write();
TASK#03
CODE:
class Animal{
String name,colour;
int age;
Animal(){
name="Lion";
colour="Yellow";
age=4;
void play(){
System.out.println("Playing ");
void eat(){
System.out.println("Eating ");
void sleep(){
System.out.println("Sleeping ");
obj.play();
obj.eat();
obj.sleep();
LAB:04
TASK#01
CODE:
class My{
String student[]={"x","y","z"};
for(String s:student){
System.out.println(s);
TASK#02
CODE:
import java.util.Date;
class Test{
System.out.println(d);
}}
TASK#03
CODE
public class Calculator{
System.out.println(a+b);
}
class Main_Calculator{
obj.add(10,15);
TASK#04
CODE
LAB:05
TASK#01
CODE:
package animal;
gender="female";
type= "german ";
colour="White";
age= 3;
}
}
package animal;
OUTPUT:
TASK#2
CODE:
package plant;
LAB#06