What are the environment variables that need to be set to run the Java programs?
CLASSPATH – A path where the class files and other resource files are present. The JVM, JDK tools searches for the class files in the CLASSPATH during runtime. PATH - An environment variable that lists directories where the command processor looks for .exe. .com, .bat files.
What is the difference between a constructor and a method?
A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. A method is an ordinary member function of a class. It has its own name, a return type (which may be void), and is invoked using the dot operator.
What is an abstract class?
Abstract class contains both abstract and non-abstract methods. Abstract class must be extended/subclassed. It serves as a template. A class that is abstract cannot be instantiated, abstract class may contain static data.
What is the difference between C++ and Java?
There are no destructors in Java
Java has no pointers.
Pointers, the most complex one, which is prone to many errors in C++ due to the irregular use of pointers. Java provides references instead of pointers.
Java has automatic memory management (garbage collection)
Java does not support Structures and Unions as those in C & C++.
Java is platform independent, while C++ is platform dependent.
Java has built-in support for comment documentation
Java does not support implicit type conversion, which can result in loss of datas.
Java doesn't provide multiple inheritance
Multiple Inheritance is powerful feature in C++ that allows us to derive a class from multiple parent classes.
Java makes use of Interfaces to implement function similar to multiple inheritance.
Java is multithreaded
Functions and global variables are not supported by Java because a Java program is encapsulated within one or more classes.
Java does not support Operator Overloading
Operator Overloading is an important feature in C++. But, it is not included in Java to make Java more