Motorola Interview Question
Software Engineer / DevelopersJava does not support #define macros or preprocessors, does not support operator overloading
In Java, no copy constructor needed, no destructor code needed
no ambiguity between null, true, false and a true boolean type is supported.
These are some among many differences
multiple inheritance is not supported in c++ so to handle multiple inheritance in java we use
interface
in interface the base class can be accessed using extend keyword
difference b/w overloading & overriding
overloading is a concept in which there will be same function name with different paameters.
In a class hierarchy, when a method in a subclass has the same name and type signature as a method in its superclass, then the method in the subclass is said to override the method in the superclass. When an overridden method is called from within a subclass, it will always refer to the version of that method defined by the subclass. The version of the method defined by the superclass will be hidden.
diff b/w c++ and java
- camSun April 17, 2011garbage collection
code once run anywhere
no use of pointers..no problem of dangling pointers...no c++ kind of memory leaks
no problems of multiple inheritance
no dynamic memory allcoation problems
large number of standard packages
diff b/w overriding and overloading
overriding: base and derived class have same function signature
overloading: difference functions with same name and return type but with different no. and or types of arguments