Java Review
What are the data types supported by Java?
-Byte -Short -int -long -float -double
What is constructors, constructor overloading in java and copy constructor?
Constructors form the basics of OOPs. Constructor overloading- passing different number and type of variables as arguments all of which are private variables of the class Copy Constructor- is a type of constructor which constructs the object of the class from another object of the same class. Java doesn't support copy constructor.
JDK vs JRE
JDK- Java development kit, is bundle of software that you can use to develop java based software JRE-Java Runtime Environment, is an implementation of the Java Virtual Machine which actually executes Java programs Each JDK contains one or more JREs
JVM
Java Virtual Machine
What is function over-riding and over-loading in java?
OOP (object oriented Programming) Overriding- a type of funtion which occurs in a class which inherits from another class. An override function replaces a function inherited from the base class. Over Loading- is the action of defining multiple methods with the same name but with different parameters
What is the difference between StringBuffer and String?
String object is immutable. -that value stored in the String object cannot be changed. StringBuffer objects are mutable. we can make changes to the value stored in the object.
what is the difference between throw and throws in JEH?
Throws: a throws clause lists the type of exceptions that a method might throw Throw: (using it) if the user wants to throw and explicit Exception, we use the Throw. The throw clause can be used in any part of code where you feel a specific exception needs to be thrown to the calling method
What is Java exception handling?
anything that is not normal is an exception. exceptions are objects.
what is the difference between arraylist and linkedlist?
arraylist- random access, only objects can be added. linklist- sequential access. the control traverses from the first node to reach the indexed node.
What is autoboxing?
autoboxing- The java compiler brings about an automatic transformation of primitive type (int, float, double, ets) into their object equivalents or wrapper type for the ease of compilation.
what is the difference between byte stream and character streams??
byte stream- for reading and writing binary data, it is incorporated. Programs use byte streams to preform byte input and output character stream- work with the characters rather than the byte. characters are stored by the unicode conventions.
what is the difference between errors, unchecked exception and checked exception?
errors- usually thrown for more serious problems checked- inherits from teh exception class. unchecked- inherits from RuntimeException
What are FileInputStream and FileOutputStream
input- contains the input byte from a file and implements an input stream output- uses for writing data to a file and also implements an output stream.
what is the use of the simpledataformat?
is once such concrete class which is widely used by java developers for parsing and formatting of dates. this is also used to conver dates to string and vice-versa
Iterator and enumeration interface:
iterators allow the caller to remove elements from underlying collection during the iteration with well-defined semantics enumeration- dynamic removal of elements from the list not present with non-sync concrete classes like linklist or arraylist
Platform independent Language
primarily works on the notion of compile once, run everywhere
FileReader and FileWriter?
reader- this class makes it possible to read the contents of a file as a stream of characters. writer- this class is used to write to character files.
Throwable
serves as the base class for an entire family of classes, declared in java.lang, that your program can instantiate and throw
static
static variable is associated with a class and not objects of that class
What is unboxing?
the automatic transformation of wrapper types into their primitive equivalent,