Java

138 lessons254 min total



  1. What is Java programming language
    Introduction to Java programming language In 1995, James Gosling founded Sun Microsystems Inc, which was later acquired by…


    2 min





  2. Features of JAVA programing language
    There were numerous characteristics that contributed to the final form of this outstanding language. The major features of…


    2 min





  3. Setting CLASSPATH in Java
    In Java, you can set the CLASSPATH variable. CLASSPATH: Application ClassLoader uses CLASSPATH as an environment variable to…


    2 min





  4. Byte Code in Java
    Byte Code: The Java byte code is a machine instruction for a Java processor chip called Java Virtual…


    2 min





  5. Java Virtual Machine(JVM)
    Programs written in Java are compiled into Java Byte code, which is then interpreted by a special Java…


    1 min





  6. JDK vs JRE vs JVM
    Let us now compare Java Virtual Machine, JRE, and JDK. The following are the key distinctions between JDK,…


    1 min





  7. Simple Hello World Program
    Requirement for Java Hello World Program: Install the JDK if you don’t have installed it, download the JDK and install…


    1 min





  8. Token and keywords
    Token The smallest individual unit in a program is known as a token. In fact, every unit that…


    1 min





  9. Identifiers
    Identifiers are fundamental building blocks of a program and are used as the general terminology for the names…


    1 min





  10. Literals in Java
    Literals(often referred to as constants) are data items that are fixed data values. Java allows several kinds of…


    2 min





  11. Escape Sequence
    Java allows us to have certain non-graphic characters in character constants. (non-graphic characters are those which cannot be…


    1 min





  12. Data Types in Java
    Data types are means to identify the type of data and associated operations of handling it. Java, like…


    3 min





  13. Variables in Java
    Variables represent named storage locations, whose values can be manipulated during the program run. For instance, to store…


    1 min





  14. Constants in Java
    In programming, a constant is an immutable entity. To put it another way, the value cannot be altered.…


    2 min





  15. Operators in JAVA
    The operators in Java represent the operations, i.e, operators perform operations on the operands. Let us discuss the…


    3 min





  16. Operator Precedence & Associativity
    Operator precedence determines the order in which the operators in an expression are evaluated. Associativity rules determine the…


    1 min





  17. Type casting in Java
    In Java, type casting is a method or process for manually and automatically converting one data type into…


    1 min





  18. Selection Statement
    The selection statement allows choosing the set of instructions for execution depending upon an expression’s truth value. Java…


    1 min





  19. if-else ladder & nested if block
    if-else ladder: The if-else-if ladder statement is used to test multiple conditions in Java. It’s used to test…


    1 min





  20. switch Statement
    Java provides a multiple-branch selection statement known as a switch. This selection statement successively tests the value of…


    1 min





  21. The switch vs if-else
    The switch and if-else both are selection statements, and they both let you select an alternative out of…


    1 min





  22. Iteration Statements(Loops)
    The iteration statements allow a set of instructions to be performed repeatedly until a certain condition is fulfilled.…


    2 min





  23. More about loops
    Multiple initialization and update Expression: A for loop may contain multiple initialization and/or multiple update expression. Optional Expression:…


    1 min





  24. Jump Statements
    The jump statements unconditionally transfer program control within a function. Java has three statements that perform an unconditional…


    1 min





  25. Java Arrays
    An array is a collection of variables of the same type that are referenced by a common name.…


    3 min





  26. Java object creation methods
    Everything revolves around the object in Java, which is an object-oriented language. An object represents a class’s runtime…


    1 min





  27. Command Line Argument in Java
    The java command-line argument is a parameter that is passed to the java program when it is run.…


    1 min





  28. OOPs in Java
    What is OOPs? Object-Oriented Programming is a methodology or paradigm for designing a program using classes and objects.  Many…


    2 min





  29. Methods in Java
    A method is a block of code, a group of statements, or a set of code that performs…


    2 min





  30. Constructor in Java
    Java constructors or constructors in Java are terminologies used to construct something in our programs. A constructor in…


    2 min





  31. More about Constructors
    Let us take a look at various other constructors in Java. Copy constructor: A copy constructor is a type…


    2 min





  32. Access Modifiers in Java
    Modifiers in Java are divided into two categories: access modifiers and non-access modifiers. The accessibility or scope of…


    2 min





  33. Non-access modifiers
    Non-access modifiers provide the JVM with information about a class, method, or variable’s characteristics. In Java, there are…


    3 min





  34. Inheritance in Java
    In Java, inheritance is a mechanism by which one object inherits all of its parent’s properties and behaviors.…


    2 min





  35. Association, Composition & Aggregation in Java
    Association: Association is a relation between two separate classes which establishes through their Objects. One-to-one, one-to-many, many-to-one, and…


    1 min





  36. Method Overloading
    Method Overloading in Java: Method Overloading occurs when a class has multiple methods with the same name but…


    1 min





  37. Method Overriding in Java
    In Java, method overriding occurs when a subclass (child class) has the same method as the parent class.…


    1 min





  38. Runtime Polymorphism
    Polymorphism: Polymorphism is a Java concept that allows us to perform a single action in multiple ways. Polymorphism…


    2 min





  39. Difference between method overloading and method overriding
    In Java, there are numerous distinctions between method overloading and method overriding. The following is a list of…


    1 min





  40. this keyword in Java
    this is a Java keyword that refers to the current object of a class. Uses of this keyword:…


    1 min





  41. Garbage Collection in Java
    Garbage collection is the method through which Java programs maintain their memory automatically. working: Java programs are compiled…


    1 min





  42. Static keyword in Java
    In Java, the static keyword is mostly used to control memory. It is also used to share a…


    2 min





  43. Final keyword in Java
    In Java, the final keyword is used to restrict the user. The final keyword in Java can be…


    2 min





  44. instanceof Operator in Java
    The instanceof operator is used to determine whether or not a reference variable contains a specific type of…


    1 min





  45. Packages in Java
    In Java, a package is a container for a collection of classes, sub-packages, and interfaces. The package keyword is used…


    2 min





  46. Sub packages in Java
    The subpackage is a package within a package. It should be developed to further categorize the package. Sub…


    1 min





  47. Abstract Class & Method in Java
    In Java, an abstract class is specified with the abstract keyword. Both abstract and non-abstract methods can be…


    1 min





  48. Interface in Java
    In Java, an interface is a blueprint for a class. It has abstract methods and static constants. In…


    1 min





  49. Interface vs Abstract class
    As we all know, abstraction refers to hiding the internal implementation of a feature and only giving the…


    1 min





  50. Nested Class in Java
    It is possible to define a class within another class in Java, and these classes are referred to…


    2 min





  51. Regular class vs static nested class
    Comparison between a normal or regular class and a static nested class. S.NO Normal/Regular inner class Static nested…


    1 min





  52. Abstract class vs Concrete class
     Following are the important differences between an abstract class and a concrete class. Sr. No. Key Abstract Class…


    1 min





  53. Strings in Java
    Strings are Objects in Java that are internally backed by a char array. They are immutable because arrays…


    1 min





  54. String class methods in Java
    Many useful methods for performing operations on a sequence of char values are available in the java.lang.String class.…


    2 min





  55. Some examples of string class methods
    The methods listed below are some of the most frequently used String class methods in Java. charAt() method:…


    1 min





  56. Java StringBuffer class
    StringBuffer is a String peer class that provides a lot of the same functionality as strings. StringBuffer represents…


    2 min





  57. StringBuilder class in Java
    The Java class StringBuilder represents a mutable string of characters. The StringBuilder class offers a substitute for the…


    2 min





  58. StringTokenizer in Java
    A string can be divided into tokens using Java’s StringTokenizer class.  Internally, a StringTokenizer object keeps track of where it is in the string that has to be tokenized.  Some procedures move this place ahead of the currently processed characters.  By extracting a substring from the string that was used to generate the StringTokenizer object, a token is returned.  It offers the initial stage of the parsing procedure, often known as the lexer or scanner.  The String Tokenizer class enables applications to tokenize strings. The Enumeration interface is implemented by it.  Data parsing is done using this class.  We must specify an input string and a string with delimiters  to use the String Tokenizer class  The characters that divide tokens are known as delimiters. The delimiter string’s characters are all accepted as delimiters.…


    1 min





  59. Exception Handling in Java
    One of the efficient ways to deal with runtime failures in Java is through exception handling, which helps…


    2 min





  60. try-catch block in Java
    Java has two keywords for managing exceptions: try-catch block. Java try block : To contain code that might…


    1 min





  61. Java Multi-catch block
    One or more catch blocks may come after a try block. A distinct exception handler must be present…


    1 min





  62. Nested try block & try with Resource Statement
    Nested try block in Java: Java allows the use of try blocks inside of other try blocks. The…


    1 min





  63. throw, throws & finally
    The Java keywords for managing exceptions include throw, throws, and finally. throw keyword: To throw an exception explicitly…


    1 min





  64. Java custom( user-defined) exception
    Because our own exceptions are derived classes of Exception, Java allows us to create them. A custom exception…


    1 min





  65. Exception Handling with Method Overriding in Java
    Exception Handling with Method Overriding: Ambiguity arises when method overriding and exception handling are combined. Which definition should…


    1 min





  66. Chained Exceptions
    What are Chained Exceptions? One exception can be related to another using chained exceptions. We can use the…


    1 min





  67. Multithreading in Java
    Java’s multithreading feature enables the concurrent execution of two or more program components for maximum CPU efficiency. A…


    2 min





  68. The life cycle of a Thread
    In Java, a thread can be in any of the following states at any given time. A thread…


    3 min





  69. Java Thread Class
    The java.lang.Thread class is a thread of execution in a program. The Java Virtual Machine enables an application…


    4 min





  70. Creating a Thread in Java
    A thread can be created in one of two ways: By extending the Thread class By implementing Runnable…


    1 min





  71. Java join() method
    join() method: The join() method of the Java.lang.Thread class enables one thread to wait until another thread has…


    1 min





  72. Thread.sleep() method in Java
    Thread.sleep() method in Java: The two variations of the sleep() method are available from the Java Thread class.…


    1 min





  73. Naming a Thread in Java
    The Thread class offers ways to modify and retrieve a thread’s name. Each thread by default has a…


    1 min





  74. Java Thread Priority
    What is Thread Priority? The concept of priorities in threads states that each thread has a priority. In…


    1 min





  75. Daemon thread in Java
    A daemon thread in Java is a background thread with low priority that runs operations like garbage collection.…


    1 min





  76. Synchronization in Java
    What is Synchronization, and why is it used? Multiple threads trying to access the same resources in a…


    2 min





  77. Inter-thread Communication in Java
    What is Inter-thread Communication? Java has a mechanism called inter-thread communication that allows another thread to enter (or…


    2 min





  78. Java.lang.ThreadGroup- class in Java
    A group of threads is created by ThreadGroup class. It provides a practical method for controlling thread groups…


    2 min





  79. Enums in Java
    What are Enums in Java? In computer languages, enumerations are used to express a collection of named constants.…


    2 min





  80. Autoboxing and Unboxing in Java
    Primitive data types are handled differently in Java, which led to the development of wrapper classes, which include…


    2 min





  81. Input-output Stream in Java
    With its I/O package, Java includes a variety of Streams that make it easier for the user to…


    3 min





  82. Serialization and Deserialization in Java
    An object’s state can be transformed into a byte stream through a process known as serialization. Deserialization is…


    1 min





  83. Java Networking
    What is Java Networking? Connecting two or more computing devices so that we can share resources is the…


    2 min





  84. Generics in Java
    Generics are types that have parameters. The goal is to make it possible for methods, classes, and interfaces…


    1 min





  85. Collections in Java
    What is a collection in Java? Java’s Collection framework offers an architecture for storing and managing a collection…


    3 min





  86. Interfaces of Java Collection framework
    Numerous Interfaces in the Collections framework define the fundamental characteristics of distinct collection classes. Collection Interface: The interface…


    2 min





  87. Java.util.Collections Class
    The Java Collections Framework includes the Collections class in the Java.util.Collections package.  The static methods that work with collections…


    6 min





  88. Java Iterator for Collection Access
    You will frequently wish to repeat the collection’s pieces. You might want to show each element, for instance.…


    2 min





  89. Java ArrayList in Collection Framework
    The java.util package contains the collection foundation component ArrayList. In Java, it offers us dynamic arrays. Although it…


    4 min





  90. Java LinkedList in Collection Framework
    The Collection framework is found in java.util package includes Linked List. This class is an implementation of the…


    4 min





  91. Java TreeSet class
    TreeSet is a widespread Java implementation of the SortedSet interface that employs a Tree for storage. Whether an…


    3 min





  92. Map Interface in Java Collection Framework
    Java includes a map interface. A mapping between a key and a value is represented by the util…


    3 min





  93. HashSet class in Java Collection Framework
    The Java HashSet class is used to create a collection that stores data in a hash table. It…


    2 min





  94. LinkedHashSet class in Java Collection Framework
    The LinkedHashSet class is an ordered HashSet with a doubly-linked List across all entries. This class is used…


    1 min





  95. HashMap class in Java Collection Framework
    Since Java 1.2, HashMap<K, V> class has been part of the Java collection. This class can be found…


    1 min





  96. Treemap class in Java Collection Framework
    Along with the AbstractMap Class, the TreeMap class in Java is used to implement the Map interface and…


    5 min





  97. Hashtable class in Java Collection Framework
    The Hashtable class creates a hash table by mapping keys to values. As a key or value, any…


    4 min





  98. Collections Class in Java
    The Collections class belongs to the Java Collections Framework. The package java.util.Collections is the package containing the Collections…


    3 min





  99. Comparable Interface in Java
    The Comparable interface is used to compare an object of the same class with an instance of that class; it also enables data ordering for user-defined class objects. The class has to implement the java.lang.Comparable interface to compare its instance, it provides the compareTo() method, which accepts an object of that class as an argument. Its sorting…


    1 min





  100. Comparator Interface in Java Collection Framework
    To sort the objects of user-defined classes, a comparator interface is utilized. A comparator object can compare two…


    1 min





  101. Legacy Classes in Java
    What are the Legacy Classes in Java?  Before Java 1.2, there were multiple classes and interfaces to hold…


    3 min





  102. Java Applet
    A Java Applet is a sort of software that is embedded in a webpage to generate dynamic content.…


    2 min





  103. Graphics in Applet
    java.awt.Graphics class in Applet has methods for working with graphics. Methods of the Graphics class: Method Description public…


    2 min





  104. JApplet class in Applet
    JApplet is a public java swing class created for developers often developed in Java. JApplet is usually written…


    1 min





  105. Event Handling in Java
    An event is defined as the act of changing the state of an item or behavior. A button…


    2 min





  106. AWT (Abstract Window Toolkit) in Java- I
    Graphical User Interface (GUI) programming is supported by the Abstract Window Toolkit (AWT). Java AWT components are platform-dependent,…


    3 min





  107. AWT (Abstract Window Toolkit) in Java- II
    Java AWT TextArea: A TextArea class’s object is a multiline zone that displays text. It allows you to…


    2 min





  108. Swing Class in Java
    Swing is a Java Foundation Classes [JFC] framework and an Abstract Window Toolkit [AWT] extension. Swing has much-improved…


    3 min





  109. Java Swing Components and Containers -I
    Containers are essential SWING GUI components. A container is a space in which a component can be placed.…


    2 min





  110. Java Swing Components and Containers -II
    Java JTable: The JTable class is used to display tabular data. It is made up of rows and…


    2 min





  111. Wrapper Class in Java
    A Wrapper class is one whose object contains or wraps primitive data types. When we create an object…


    3 min





  112. Byte Class in Java
    The Byte class creates an object out of a primitive type byte value. An object of type Byte…


    1 min





  113. Short class in Java
    The Short class is a wrapper class for the primitive type short. It contains several methods for dealing…


    1 min





  114. Float class in Java
    The Float class is a wrapper class for the primitive type float. It contains several methods for dealing…


    2 min





  115. Double class in Java
    The Double class is a wrapper class for the primitive type double. It contains several methods for dealing…


    2 min





  116. Boolean class in Java
    In java.lang package, there is a wrapper class Boolean. A value of the primitive type boolean is wrapped…


    1 min





  117. Character class in Java
    In java.lang package, Java includes a wrapper class called Character. A single field of type char is contained…


    2 min





  118. Reflection in Java
    Reflection is a runtime API for inspecting and modifying the behavior of methods, classes, and interfaces. The classes…


    2 min





  119. Java.lang.Class class in Java
    Java includes a class called Class in the java.lang package. In a running Java application, instances of the…


    2 min





  120. Remote Method Invocation(RMI) in Java
    Remote Method Invocation (RMI) is an API that allows an object to call a method on another object…


    4 min





  121. What is JDBC?
    JDBC (Java Database Connectivity) is the Java API for connecting to a database, issuing queries and commands, and…


    6 min





  122. JDBC API(java.sql Package)
    The Java Database Connectivity (JDBC) API allows Java programmers to access data from any database. You can use…


    3 min





  123. Java Database Connectivity
    To connect any Java application to a database using JDBC, follow these five steps. These are the steps…


    1 min





  124. Java connect to MySQL database with JDBC
    Follow the steps below to connect a Java application to a MySQL database using the JDBC Driver. Download…


    2 min





  125. Using the Thin Driver to Connect to an Oracle Database
    Follow the steps below to connect a Java application to an Oracle database using Thin Driver. Download Oracle…


    1 min





  126. Java connectivity to MongoDB database
    MongoDB is a no-SQL database that is document-oriented. MongoDB, which was first released in 2009, successfully replaced rows…


    2 min





  127. Inner class in Java
    In Java, an inner class is a class that is declared within another class or interface. To summarize,…


    1 min





  128. File class in Java
    The File class represents a file or directory path name in Java. Because file and directory names differ between platforms, naming them with a simple string is insufficient. The File class is used to create files and directories, search for files, delete files, and so on. Fields of…


    7 min





  129. Abstract List in Java
    This class provides a skeletal implementation of the List interface in order to reduce the effort required to…


    2 min





  130. AbstractSequential List in Java
    The Java Collection Framework includes the AbstractSequential List class, which implements the Collection interface, and the AbstractCollection class.…


    1 min





  131. CopyOnWriteArrayList class
    The CopyOnWriteArrayList class, which implements the List interface, is introduced in JDK 1.5. It is an enhanced version…


    2 min





  132. AbstractSet in Java
    AbstractSet is a Java Collection Framework class that implements the Collection interface and extends the AbstractCollection class. It…


    1 min





  133. EnumSet in Java
    What is EnumSet in Java? The EnumSet is a specialized implementation of the Set interface designed for use…


    1 min





  134. IdentityHashMap class in Java
    The HashMap class is similar to the IdentityHashMap class. The IdentityHashMap implements the Map interface using Hashtable, and…


    2 min





  135. SortedMap Interface in Java
    SortedMap is a collection framework interface. It guarantees that the entries are kept in ascending key order. This…


    1 min





  136. Queue Interface in Java
    The Queue interface extends the Collection interface and is present in java.util package is used to hold the…


    1 min





  137. Deque Interface in Java
    The Deque interface in java.util package is a queue interface subtype. A linear collection with the ability to…


    3 min





  138. Layout Managers in Java
    Layout Managers are used to arrange components in a specific order. The Java Layout Managers allow us to…


    2 min