Category

Blog

Category

Introduction The conditions and logical statements are an integral part of any program. A code is mainly comprised of series of conditions and their possible outputs in either case. A Switch case statement is one of the conditional statements commonly found in almost every other programming language. Switch case in Java The switch case is very commonly used in Java. It is a multi-way branch statement that provides paths to execute different parts of the code based on the value of the expression. The expression can be a byte, short, char, and int primitive data types. From JDK7, it can also be used with enumerated (Enum) data types in Java, the String class and Wrapper classes. Following is the Syntax of switch case in Java:  switch(variable or an integer expression) {    // case statements  case value 1 :       // Statements to executed in case of value 1 is true    break; // optional…

Introduction Java 7 introduced multiple features at the time of its release. However, one feature that stands out among Java developers is invokedynamic bytecode that was part of JSR 292. We will be further discussing in this article why it is such a powerful tool for the Java platform, especially for JVM dynamic languages. What is invokedynamic Java? Invokedynamic Java is a bytecode instruction that allows the implementation of dynamic languages in the JVM using dynamic methods. It allows the Java compiler to generate a code that can call methods with a certain specification. It can be used to build more flexible and more efficient JVM-based languages. When invokedynamic Java was initially introduced in Java 7, it was intended to further enhance the JVM support for dynamically typed languages.  Since its first release, the invokedynamic opcode has been extensively used for dynamic JVM-based languages like JRuby and even for statically typed languages like Java itself. Dynamic…

Introduction Java is known for its exemplary features and Java inner class is one of them. Although variables, methods and constructors are usual members of a class, it is also possible to have another class declared inside a primary class, which is essentially a Java inner class. The scope of an inner class is limited to the scope of its outer class. For instance, if class B is defined inside class A, then class B cannot exist as itself outside class A. Inner classes were introduced back when Java 1.1 was rolled out. Following is the simple Syntax of a Java inner class: 1. class classA 2. { 3. //other members of class A defined here. 4. class classB 5.      { 6.        // members of class B defined here. 7.      } 8.  } Java inner class is one of the most well-regarded features…

Introduction The application development process has become significantly vast and complex due to a variety of features that are now required in modern applications. To cater to that, there are multiple options available in the tech industry for architecture design patterns. The three most prominent ones are Model View View-Model (MVVM), Model View Presenter (MVP), and Model View Controller (MVC). All three of them being very popular and their remarkable design patterns often spark the debate of MVC vs MVP vs MVVM. This article will provide you with a complete outline for MVC vs MVP vs MVVM and the top 10 differences between them that you should know. It would be an ideal opportunity for new Java developers to find out which design pattern they should go with if they are planning to start developing applications professionally. Why do we need design patterns? Before diving into their differences, let’s have…

In general, modularization means to construct something in different parts or modules. The primary reason for modularization is to make things manageable and get better control over them. The same concept is applied in application development. Designing a Java application in different modules, instead of as a single, monolithic design is what we call modularization in Java. Why do we need modularization? Modularity enables developers to independently work on their areas of application like testing or engaging in parallel development in projects to remain time efficient. A standardized interface is then used to connect the modules for communication. It helps developers in minimizing coupling and optimizing the application development process by reducing the complexity. Modularization in Java The Java programming language was not designed keeping modularization in mind, but it was later introduced in Java 9 considering the following three core ideas to benefit Java developers: To be able to…

Introduction Java is known for its diverse offerings. From a vast variety of libraries to various features, Java provides it all. One such useful feature is the HashMap. HashMap is a dictionary data structure provided by Java. It is a Map-based collection class used to store data in pairs of a key and its corresponding value. Being a very useful feature, we are supposed to have an effective HashMap Java implementation for its proper utilization. Why HashMap Java Implementation Should Be Done? The primary benefit of using a HashMap in Java is relatively faster data retrieval. Developers can hash a key by implementing a hashing algorithm and relate it with the data index in memory to retrieve it faster. Beginners and amateur Java developers often find HashMap Java implementation to be a bit difficult and lengthy process due to countless long and complicated methods of HashMap Java implementation available online.…