Introduction: Prime Number is an integer greater than 1 and only divisible by 1 and itself. For instance – 2, 3, 5, 7, 11, 13 etc are all prime numbers. In other words, any number with only two factors – 1 and the number itself is known as a prime number. Numbers like 4, 8, […]
Introduction: In this tutorial, we’ll learn how to sort arrays as well as collections like List, Set, and Map using Java API. Sorting Arrays: Java exposes java.util.Arrays.sort() API which helps us to sort our arrays. There are two flavors to it: public static void sort(type[] arr) //sorts array in range [fromIndex – toIndex) : toIndex […]
Introduction: java.lang package provides a wrapper class for each of the primitive data types. Since Java is an object-oriented language, these wrapper classes help us in treating our primitives much like any other Java object. All wrapper classes are final. Also, the objects instantiated of these wrapper classes are immutable i.e. the value stored within […]
Introduction: Java Enum is a Java type which is used to define a fixed set of constants. For instance, if we wish to store the names of all the months like JANUARY, FEBRUARY, MARCH etc we should prefer creating an enum to hold it. In this tutorial, we’ll learn why using Enums is a good […]
Introduction: Java var-args(variable-argument) was the concept first introduced in JDK1.5. As the name suggests, it helps us to create a method which can accept a variable number of arguments based on our varying needs. Prior to JDK1.5, if we wish to create a method which can accept any number of arguments, we would probably opt […]
Looping statements provide a means to achieve an iteration over a set of elements or to perform some operation repeatedly without adding redundant lines of code.Java provides a variety of looping or iteration statements. For your Java OCA exam, you need to be comfortable with the use of Java looping statements and we have some […]
When dealing with loops in Java, break and continue keywords are the ones we often come across. We’ll see what they mean and how can they be used. We’ll be learning the usage of Java break and continue statements in both labelled as well as unlabelled context. Let’s start by first understanding what is a […]
The try-catch-finally blocks available in the Java exception handling framework are a great way to deal with exceptions. In the previous post, we covered what exceptions are and their types – checked vs unchecked exceptions. Today we’ll enable you to be a pro in using Java try-catch-finally blocks for exception handling. Before proceeding with this […]
Java Exception framework helps us to handle exceptions in Java very effectively and without much pain. In this post, we’ll learn about Exceptions in Java, their types, the difference between checked and unchecked exceptions. We’ll also cover significantly good number of classes available in Java Exception framework. Introduction : Exceptions are abnormal disruptions in the […]
Java Operators is one of the topic in which Java OCA aspirants score comparatively a lot lower than the other sections of the test. In this post, we’ll cover all the must-know points about Java Operators for your OCA exam. Now pass your Java OCA Exam with flying colours! Operator Precedence & Associativity : Precedence […]