You are on page 1of 12

JAVA ASSIGNMENT-1

Ans-1
C++ JAVA
C++ is platform-dependent. Java is platform-independent.

C++ is mainly used for system Java is mainly used for application
programming. programming. It is widely used in
Windows-based, web-based, enterprise,
and mobile applications.
C++ was designed for systems and Java was designed and created as an
applications programming. It was an interpreter for printing systems but later
extension of the C language. extended as a support network
computing. It was designed to be easy
to use and accessible to a broader
audience.
C++ supports the goto statement. Java doesn't support the goto
statement.
C++ supports multiple inheritance. Java doesn't support multiple
inheritance through class. It can be
achieved by using interfaces in java.
C++ supports operator overloading. Java doesn't support operator
overloading.
C++ supports pointers. You can write a Java supports pointer internally.
pointer program in C++. However, you can't write the pointer
program in java. It means java has
restricted pointer support in java.
C++ uses compiler only. C++ is Java uses both compiler and interpreter.
compiled and run using the compiler Java source code is converted into
which converts source code into bytecode at compilation time. The
machine code so, C++ is platform interpreter executes this bytecode at
dependent. runtime and produces output. Java is
interpreted that is why it is platform-
independent.
C++ supports both call by value and call Java supports call by value only. There is
by reference. no call by reference in java.

C++ supports structures and unions. Java doesn't support structures and
unions.
Ans-2:
In Object Oriented Programming the class is a blueprint
or template for creating object, which are ‘instances of
a class’. A class defines a set of properties or methods
that on object of that class can have. The properties
represent the state of the object and the methods
represent the behaviour of object. When an object is
created from class, it’s called instance of that class.

You might also like