You can measure method execution time in java using the method System.nanoTime() or System.currentTimeMillis(). Put this method before and after the method or piece of code for which you want to measure the running time. Find the difference of the time you got before and after your code. The difference is the running time. Method […]
Free PDF: ALL OOPs Concepts Using Java with 1 Tiny Program – Explained!
Learn OOPs concepts using Java with 1 real-life program example. You can also DOWNLOAD pdf FREE! ALL oops features used in this program are explained.
User Defined Exception in Java with Real-time example
User Defined Exception in Java with a real-life example and code. You’ll learn how to use this exception in a class. User defined exception means you write your own custom exception class to use in a program. If an exception occurs, it throws the exception. You can use your custom message to show to the […]
Abstract Class in Java with Purpose and Real Time Example
Learn the abstract class in Java with crystal clear definition, purpose with real time example, code, uses and important points. Abstract Class in Java The abstract class is designed to contain both the defined and abstract methods. This class may contain only defined methods OR only abstract methods OR both. NOTE: Recommend reading first, the […]
Java: Abstract method in Easy Way with Real-Time Examples
Learn the abstract method in Java, clear definition, Where to Use and why to use in a program with super simple real-time examples. What is an Abstract method in Java? A method that has only a declaration and no implementation (no body) is known as an abstract method. The keyword “abstract” is used in a […]
Issue Of Not Using Abstraction In Java And Its Solution
See the issue when you don’t use abstraction concept in java and its solution with a program example and explanation. First, we will create a program in which abstraction is not applied and discuss the problem because of it. The, we will see the solution of the problem with same program example by applying abstraction. […]
Static Block in Java
Learn Static Block in java programming with example. A class can have a Static block, where we perform some operations or write some statements, if we want them to call before calling constructor of the class. Here is the static block defined in the class X. Just write the keyword static and put braces {} […]
Static method in Java
Learn static method in java with example i.e. how to write static method in a class and why do we use static methods in application. STATIC METHOD Before explanation, see how we make a method static in a class. It’s simple, just write static keyword before the method. “Call Static methods of a class using […]
Static Variable in Java
Learn Static variables in java with example and how it is different than non-static variables of a class in java programming. For better understanding, we will use static and non static (instance variables) both in example. Static Variables A static variable is shared by all objects of the class. Meaning, static variable has only copy […]
Final Method in Java
Learn final method in java with example and explanation. In a class, we make a method final so that no child class can override and implement it. NOTE: If a class is having final method, it does not mean that the class is also a final class. Purpose of final method is only that it […]