Tag: Java

  • Modifiers in Java

    Modifiers in Java

    Access Modifiers Access modifiers determine the extent to which a class or its members are visible to other classes, and they can modify both classes and individual members. A class can be modified with public or package private (no explicit modifier). A class modified with public is visible to all classes everywhere, while a class […]

  • Introduction to Spring Framework

    Introduction to Spring Framework

    DI Container Overview of Spring Framework’s DI Dependency injection, or DI, is a process where an object defines its dependencies only through arguments to its constructor or setter method, or properties that are going to be set on an object instance after it’s created. DI helps to decouple components; when dependencies are declared as interfaces […]

  • Lambda and Stream

    Lambda and Stream

    Lambda Expression Replace Anonymous Class with Lambda A lambda expression in Java is a concise and straightforward way of declaring and instantiating a class which implements a functional interface. We’ll explore multiple means to pass functionalities to method invocations in the order from redundant to concise. Suppose that we iterate through a list and print […]

  • Concurrency in Java

    Concurrency in Java

    Threads By initializing and launching an object which adheres to specific implementations, we can create another thread, which is independent of the other operations described in main method, and we can execute them simultaneously. There’re two ways to create a thread; extending Thread class and implementing Runnable interface. In either way, what we have to […]

  • Garbage Collection in Java

    Garbage Collection in Java

    Java Virtual Machine A Java program written in a .java file is compiled into bytecode which is stored in a .class file. This bytecode is executed on Java Virtual Machine (JVM), not directly on an operating system. Since JVMs specific to each operating system are distributed, we don’t have to worry about the platform on […]

  • Exceptions in Java

    Exceptions in Java

    Checked and Unchecked Exceptions An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of program’s instruction. Exceptions are categorized into two types; checked exceptions and uncheck exceptions. Checked exceptions indicate exceptions which well-written applications can anticipate and recover from. Java requires us to take a precaution […]

  • Generics in Java

    Generics in Java

    Generic Types A generic type is a generic class or interface which is parameterized over types. When defining a generic-type class or interface, what we have to do is describing type parameters, \(T_1, T_2,…,T_n\), which follow the class or interface name and are enclosed in angle brackets. Next, to invoke a generic-type class, we specify […]