Category: Java

  • Static synchronization

    If you make any static method as synchronized, the lock will be on the class not on object. Problem without static synchronization Suppose there are two objects of a shared class(e.g. Table) named object1 and object2.In case of synchronized method and synchronized block there cannot be interference between t1 and t2 or t3 and t4 […]

    Posted in: Java

  • Garbage Collection

    In java, garbage means unreferenced objects. Garbage Collection is process of reclaiming the runtime unused memory automatically. Advantage of Garbage Collection: It makes java memory efficient because garbage collector removes the unreferenced objects from heap memory. It is automatically done by the garbage collector so we don’t need to make extra efforts. How can an […]

    Posted in: Java

  • Shutdown Hook

    The shutdown hook can be used to perform cleanup resource or save the state when JVM shuts down normally or abruptly. Performing clean resource means closing log file, sending some alerts or something else. So if you want to execute some code before JVM shuts down, use shutdown hook. When does the JVM shut down? […]

    Posted in: Java

  • Daemon Thread

    Daemon thread in java is a service provider thread that provides services to the user thread. Its life depend on the mercy of user threads i.e. when all the user threads dies, JVM terminates this thread automatically. There are many java daemon threads running automatically e.g. gc, finalizer etc. You can see all the detail […]

    Posted in: Java

  • Remote Method Invocation

    The Remote Method Invocation (RMI) is an API that provides a mechanism to create distributed application in java. The RMI allows an object to invoke methods on an object running in another JVM. The RMI provides remote communication between the applications using two objects stub and skeleton. Understanding stub and skeleton RMI uses stub and […]

    Posted in: Java

  • JDBC API

    This JDBC tutorial covers all the topics of JDBC with the simple examples. JDBC is a Java API that is used to connect and execute query to the database. JDBC API uses jdbc drivers to connects to the database. Why use JDBC? Before JDBC, ODBC API was used to connect and execute query to the […]

    Posted in: Java

  • Java Reflection API

    Java Reflection APIĀ is a process of examining or modifying the run time behavior of a class at run time. The java.lang.Class class provides many methods that can be used to get metadata, examine and change the run time behavior of a class. The java.lang and java.lang.reflect packages provide classes for java reflection. Where it is […]

    Posted in: Java

  • Java Applet

    Java Applet is a special type of program that is embedded in the webpage to generate the dynamic content. It runs inside the browser and works at client side. Advantage of Applet There are many advantages of applet. They are as follows: It works at client side so less response time. Secured It can be […]

    Posted in: Java

  • LayoutManagers

    LayoutManagers: The LayoutManagers are used to arrange components in a particular manner. LayoutManager is an interface that is implemented by all the classes of layout managers. There are following classes that represents the layout managers: java.awt.BorderLayout java.awt.FlowLayout java.awt.GridLayout java.awt.CardLayout java.awt.GridBagLayout javax.swing.BoxLayout javax.swing.GroupLayout javax.swing.ScrollPaneLayout javax.swing.SpringLayout etc. BorderLayout: The BorderLayout is used to arrange the components in […]

    Posted in: Java

  • Java Swing

    Java Swing tutorial is a part of Java Foundation Classes (JFC) that is used to create window-based applications. It is built on the top of AWT (Abstract Windowing Toolkit) API and entirely written in java. Unlike AWT, Java Swing provides platform-independent and lightweight components. The javax.swing package provides classes for java swing API such as […]

    Posted in: Java