Interview Quetions: Q)Is java 100%Object oriented Programming or - TopicsExpress



          

Interview Quetions: Q)Is java 100%Object oriented Programming or Pure Object Oriented programming? Justify it A)Java is a pure object oriented language but not 100% object oriented language. -To call one language as 100% object oriented language it must satisfy the following 7 conditions. They are (OOPS principle): i) Abstraction ii) Encapsulation iii) Polymorphism iv) Inheritance v) All primitives must be Objects vi) All user defined types must be Objects vii) Message pass between the methods must be carried on using objects In java we have primitives as int, float, double which are not objects. So we can say java is pure but not 100% object oriented. 1) What is the diff b/w PATH and CLASS PATH ? A) PATH: i) PATH is an environment variable which is used to locate JDK binaries like "java" or "javac" command used to run java program and compile java source file ii) In order to set PATH in Java you need to include JDK_HOME/bin directory in PATH environment variable iii) PATH can not be overridden by any Java settings iv) PATH environment variable is used by operating system to find any binary B) CLASSPATH: i) CLASSPATH environment variable is used by System or Application ClassLoader to locate and load compile Java bytecodes stored in .class file ii) in order to set CLASSPATH in Java you need to include all those directory where you have put either your .class file or JAR file which is required by your Java application. iii) CLASSPATH can be overridden by providing command line option -classpath or -cp to both "java" and "javac" commands iv) CLASSPATH is only used by Java Class Loaders to load class files. 2) What are the topics newly intoduced in Java1.5 versions ? A) Code named Tiger and released on September 30, 2004 Features are • Generics • Enhanced for Loop • Autoboxing/Unboxing • TypesafeEnums • Varargs • Static Import • Metadata (Annotations) • Assertion Generics: Generic in Java is added to provide compile time type-safety of code and removing risk of ClassCastException at runtime which was quite frequent error in Java code Enhanced for Loop:It is used to iterate through the elements of the array or collection.If we use enhanced for loop we don’t need Iterator, end condition for forloop increment/decrementing loop counter Normal way to step through the elements of the array for (int i = 0; i
Posted on: Wed, 26 Jun 2013 03:03:06 +0000

Trending Topics



Recently Viewed Topics




© 2015