Interfaces belong to abstract class in Java which prevents it from instantiating. If an interface is instantiated, it will rebel the model of Object Oriented Programming because some methods present in an interface does not have any definitions. Instantiating an interface will result in compile error. Interfaces does not have any variables or method bodies. […]
How to Interface Anonymous Inner Class?
It is possible to implement an interface or extend the class of anonymous inner class. The interfaces of anonymous inner classes are always static. An anonymous inner class can either implement an interface or extend the class but it cannot do both at the same time. Example for creating interface in anonymous inner class In […]
How to Create Threads in Java?
Threads in Java are similar to any other objects in Java. Usually, threads are instance of Java class java.lang.thread or thread will be the instance of subclass belonging to the class java.lang.thread. Thread classes will use methods and constructors to perform operations on the thread. Extension of object class and implementation of runnable interface are […]
How to Declare and Extend an Interface?
Similar to class, interface in Java is a collection of abstract methods. Interfaces are implemented by class so it inherits the abstract methods. Interface might contain nested types, default and static methods and constants. Only default and static methods will contain the method bodies in interface. The coding process of interface is similar to the […]
Difference Between Nested Static and Inner Class
Inner and Nested Classes in Java are classes which are declared inside another class. In Java the class which are declared as static is called as “nested static class” while other classes are known as “inner classes”. The difference between inner and nested class is a common question in Java interviews. In this article, will […]
Difference Between Abstract Class and Interface
The difference between the interface and abstract is a very common question in core Java interviews. It is better to start answering this question with a slight introduction about abstract class and Interface. What is Abstract Class? Abstract classes are the class, which defines an abstract concept and it cannot be instantiated. Abstract classes are […]
Difference Between Class and Objects
The knowledge about the difference between class and object question is the requirement for a candidate to attend a programming interview that involves any object oriented programming. Every programmer regard the terms, object and class as pillars of OOPS. Class can be defined as the blueprints and objects are existing things that are created from the […]
- « Previous Page
- 1
- …
- 7
- 8
- 9
- 10
- 11
- …
- 13
- Next Page »