Method Overriding in Java

java-thumbnail

Method Overriding is concept of overriding a same method in the child class. This is fall under the dynamic polymorphism  or run time polymorphism. A method defined in the parent class is considered as the common behaviour and the child classes are expected to override the common behaviour with own implementation. There are multiple restrictions enforced […]

Instanceof Operator

java-thumbnail

Instanceof Operator is important for writing the condition to check if a particular variable reference is of specific type / class. In short it is type checking condition. This operator returns true or false depends on the condition output. It always return false if you compare null value with any class. Lets look at an […]

Instance Initializer in Java

java-thumbnail

Instance initializer in Java is used for initializing the instance variables inside a class. It is a simple block without any modifiers used inside any class. If you declare a instance variable with value, then this value can be overridden in the instance initializer or in the constructor. The order of the execution as follows: […]

Access Modifiers in Java

java-thumbnail

This tutorials explains the various access modifiers used in Java language and the scope for the each modifier. There is four types of access modifiers in Java. private default protected public Private Modifier If you declare anything private inside a class, then it must be accessed inside that class. Other classes can not access that […]

OCPJP 6 Mock Exam -10

ocpjp-6-thumbnail

1 . Given: What is the result? Compilation succeeds Compilation fails because of an error on line 1 Compilation fails because of an error on line 3 Compilation fails because of an error on line 7 2 . Given: The ClassA class can be compiled successfully by inserting one of three possible options on line 3. […]

Java Keywords

java-thumbnail

Java has more than 50 keywords for the different operations. Here is the list of all the keywords and its purpose. Keyword Description abstract Abstract keyword can be use with classes and methods to defer the actual implementation to the child classes. assert This keyword used for testing the truth of a condition. boolean Indicates […]

Static Keyword

java-thumbnail

Static keyword in Java used for indicating the members are belong to the class and not to the instance. It means that, if you declare a static members, it is shared among all the instances of that class. Also note that the static members are initialized before the instance creation of that class. Static keyword […]

OCPJP 6 Mock Exam – 9

ocpjp-6-thumbnail

1 . What is the result when you compile and run the following code? Choose the one below: Compile Time error Runtime error Prints Testing myTop method in Top class on the console Prints Testing myTop method in Down class on the screen 2 . Which of the code fragments will throw an “ArrayOutOfBoundsException” ? […]

JSP Implicit Objects

java-ee-thumbnail

Java EE Tutorials JSP Tutorials Recommended Books for Java Server Pages (JSP) Implicit objects are java objects that are created by container when JSP page is being translated to servlet and are accessible to Java scriptlets or expressions in JSP pages based on scope of particular object type. There are 9 implicit objects which are […]

JSP Directives

java-ee-thumbnail

Java EE Tutorials JSP Tutorials Recommended Books for Java Server Pages (JSP) Directives specifies translation time instruction to JSP engine. There are three types of directives: page directive include directive taglib directive JSP Page Directive This directive can be used to specify any of a number of page-dependent attributes such as scripting language to use, […]