Java

Exploring some interesting stuffs in java.

Featured
Java

System.out.println : So called SOP/sysout

Widely used statement in Java and interestingly its one of the most number of times compiled statement in the history of java, also commonly asked interview question. Here we will try to understand some interesting fact about sysout. Inside System Class  (Check with JDK Source Code) Java Doc public final static PrintStream out = nullPrintStream(); As you […]

Read More
Java

Assert Keyword and Its Use

Assert The Dictionary Meaning of Assert is 1. To state or express positively; 2. To defend or maintain (one’s rights, for example). Assert In JAVA : Added to JAVA in version 1.4 Definition : Java assertion feature allows developer to put assert statements in Java source code to help unit testing and debugging. Assert keyword […]

Read More
Java

Accessing Private Members of a Java Class using Reflection

Java Reflection API provides a feature to access private members of a Java Class. java.lang.reflect package provides the AccessibleObject class that is parent class of Constructor, Method, and Field class. Using the AccessibleObject class, we can change the access control flags of a Reflection Object Lets understand how to achieve this with below example. Class […]

Read More
Java

Static Imports

We have been using lots of import statement in our code. The only value import statement have is that they save typing and improves the code readability. With Java 5 import statement was enhanced to provide even greater keystroke-reduction capabilities and this is called static import. This can be used when we want to use […]

Read More
Java

JAVA Class Without Main Method

[ CoreJavaTest.java ] public class CoreJavaTest extends MainClass { { System.out.println(“Inside CoreJavaTest”); } } class MainClass { public static void main(String[] args) { System.out.println(“Inside Main”); } } What Output Do u expect …

Read More