0% found this document useful (0 votes)
97 views

OOP Assignment PDF

The document discusses features of Java programming language including: - Java is simple, robust, object-oriented, platform independent, secure, and high-performance. - Java is platform independent because bytecode can run on any machine with a Java Virtual Machine (JVM). The JVM converts bytecode into machine code. - Data security in Java is implemented through access modifiers like private, public and protected to control access to class members.

Uploaded by

Adarsh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views

OOP Assignment PDF

The document discusses features of Java programming language including: - Java is simple, robust, object-oriented, platform independent, secure, and high-performance. - Java is platform independent because bytecode can run on any machine with a Java Virtual Machine (JVM). The JVM converts bytecode into machine code. - Data security in Java is implemented through access modifiers like private, public and protected to control access to class members.

Uploaded by

Adarsh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Object Oriented Programming Assignment

1.List features of java and explain?

a)Simple
Java is easy to learn and its syntax is quite simple, clean and easy to
understand.The confusing and ambiguous concepts of C++ are either left out in
Java or they have been re-implemented in a cleaner way.

b)Robust

Java makes an effort to eliminate error prone codes by emphasising


mainly on compile time error checking and runtime checking. But the main areas
which Java improved were Memory Management and mishandled Exceptions by
introducing automatic Garbage Collector and Exception Handling.

c)Object Oriented Programming

Java is a fully object-oriented programming language. Everything in


Java is an object.It has all OOP features such as abstraction, encapsulation,
inheritance and polymorphism.

d)Platform Independent

Unlike other programming languages such as C, C++ etc which are


compiled into platform specific machines. Java is guaranteed to be write-once, run-
anywhere language.On compilation Java program is compiled into bytecode. This
bytecode is platform independent and can be run on any machine, plus this
bytecode format also provide security. Any machine with Java Runtime
Environment)(JVM) can run Java Programs.

e)Secure

The Java platform is designed with security features built into the
language and runtime system such as static type-checking at compile time and
runtime checking (security manager), which let you creating applications that can’t
be invaded from outside.Access control allows to hide data from other programs
and parts of the same program giving more data security.

f)High performance

Java is faster than other traditional interpreted programming


languages because Java bytecode is "close" to native code. It is still a little bit
slower than a compiled language .Java enables high performance with the use of
just-in-time compiler.

2.Java is platform independent ,Justify ?

The meaning of platform independent is that, the java source code


can run on all operating systems.Whenever, a program is written in Java, the javac
compiles it.The result of the Java compiler is the .class file or the bytecode and not
the machine native code.The bytecode generated is a non-executable code and
needs an interpreter to execute on a machine. This interpreter is the JVM and thus
the Bytecode is executed by the JVM.JVM is available for all the platforms,
different platforms have different JVM but all the JVM’s can execute the same byte
code.Hence java is platform independent.Java is platform-independent language,
but the JVM is platform-dependent.

3.What is JVM?Explain.

The Java Virtual Machine is a program whose purpose is to execute other


programs.The JVM has two primary functions: to allow Java programs to run on
any device or operating system ("Write once, run anywhere"), and to manage and
optimise program memory.JVM is a engine that provides runtime environment to
drive the Java Code or applications. It converts Java bytecode into machines
language. JVM is a part of JRE(Java Run Environment). It stands for Java Virtual
Machine.In other programming languages, the compiler produces machine code
for a particular system. However, Java compiler produces code for a Virtual
Machine known as Java Virtual Machine.First, Java code is complied into
bytecode. This bytecode gets interpreted on different machines.JVM is responsible
for allocating memory space.Java is called platform independent because of Java
Virtual Machine. As different computers with the different operating system have
their JVM, when we submit a .class file to any operating system, JVM interprets
the bytecode into machine level language.

4.How data security is implemented in java?

Data security is implemented using access specifiers and by abolishing the


use of abstract pointers.Data security is implemented by data hiding.Data hiding is
a concept in object-oriented programming which confirms the security of members
of a class from unauthorised access. Data hiding is a technique of protecting the
data members from being manipulated or hacked from any other source. Data is
the most sensitive and volatile content of a program which if manipulated can
result in an incorrect output and it also harms the integrity of the data.  Data hiding
is controlled in Java with the help of access modifiers (private, public and
protected). The data which is public is accessible from outside the class hence if
you want to hide your data or restrict it from being accessed from outside, declare
your data private. Private data is only accessible to the objects of that class
only.Protected data is accessible within the same package and to all subclasses.

The default data members are available only to classes in the same package.All
data that need to be secured can be declared private hence denying it outside
access and must manipulated using member function.Hence access specifiers
implements data security in java.

5.Why java is known as internet language?

Java is known as internet language because of its portability and platform


independence.Java code can run-on any machine with JDK and hence it became
very popular for web based applications.Also the first application program written
in Java was HotJava, a Web browser to run applets on the Internet.Applets are
small programs that are usually run on java enabled browsers.These applets were
able to run on any machine with a compatible browser due to the platform
independent nature of java.Java enabled users to transfer online java bytecode
that can run on any machine with JDK.Hence it enabled online transfer of
programs and online programs (applets) that can be accessed from anywhere in
the world.That is why java is known as Internet language.

6.What is mean by garbage collection in java?

Garbage Collector is a program that manages memory automatically


wherein de-allocation of objects is handled by Java rather than the programmer. In
the Java programming language, dynamic allocation of objects is achieved using
the new operator. An object once created uses some memory and the memory
remains allocated till there are references for the use of the object.When there are
no references to an object, it is assumed to be no longer needed, and the memory,
occupied by the object can be reclaimed. There is no explicit need to destroy an
object as Java handles the de-allocation automatically.The technique that
accomplishes this is known as Garbage Collection. Programs that do not de-
allocate memory can eventually crash when there is no memory left in the system
to allocate. These programs are said to have memory leaks.Garbage collection in
Java happens automatically during the lifetime of the program, eliminating the
need to de-allocate memory and thereby avoiding memory leaks.

Adarsh M S Nair

S5 E2

You might also like