Java

IntelliJ Maven Tutorial: Creating a HelloWorld Java Program in 10 Easy Steps

HelloWorld Java Program with Maven A Step-by-Step Guide Creating a Java project using Maven is a fundamental step for Java developers. In this tutorial, we will walk through the process of creating a simple HelloWorld Java program using Maven. This step-by-step guide will help you understand the basics of Maven and how to structure a …

IntelliJ Maven Tutorial: Creating a HelloWorld Java Program in 10 Easy Steps Read More »

03.06.1. BigDecimal Class

BigDecimal Class Eclipse: Oxygen Java: 1.8 Introduction In Java, the BigDecimal class is a useful tool for performing mathematical operations with a high degree of precision. Unlike the primitive double and float data types, BigDecimal can accurately represent decimal numbers and avoid common rounding errors. In this article, we will explore the concept of BigDecimal …

03.06.1. BigDecimal Class Read More »

09.12. Final Keyword

Eclipse: Oxygen Java: 1.8 Final Keyword Final keyword can be applied to variables, methods, classes, etc. It is used in various contexts to define an entity that can only be assigned once. Once a final variable has been assigned, the variable cannot be changed. Therefore, the user tries to change the value using the setter …

09.12. Final Keyword Read More »

Xtra – SureFire Pom.xml Sample

SureFire Pom.xml Sample

 

Xtra – JUnit 5 Basic maven configuration Sample (POM.xml)

JUnit 5 Basic maven configuration Sample (POM.xml)

 

12.05. Bounded type parameter

Bounded Type Parameter Eclipse: Oxygen Java: 1.8 There could be a situation where we need the user to enter a specific type of quantity. For such cases we use generics. For example, a method that accepts only String must not be passed with numbers and, therefore, bounded type parameters are used for such purposes. In …

12.05. Bounded type parameter Read More »

12.06. Wildcard in generics

Wildcards in generics Eclipse: Oxygen Java: 1.8 Introduction Java generics use wildcards to represent unknown or generic types that can be used in different ways. Wildcards are denoted by the question mark symbol (?) and can be used in upper-bounded, lower-bounded, or unbounded forms. Types of Wildcards: There are three types of wildcards used in …

12.06. Wildcard in generics Read More »

12.04. Generic method

Generic Method Eclipse: Oxygen Java: 1.8 Description A generic method in Java is a method that is defined with one or more type parameters. These type parameters are specified using angle brackets (< and >) and can be used to define the types of the method’s parameters or its return type. For example, consider the …

12.04. Generic method Read More »

13.03. Queue and Dequeue

Queue Eclipse: Oxygen Java: 1.8 The queue is a data structure that First in First Out(FIFO) structure. This is based on the real-life concept of the queue or a line of people. Therefore, this can be very useful in several ways, such as to find the level order traversal in a tree, etc. Therefore, the …

13.03. Queue and Dequeue Read More »

13.04. Maps

Maps Eclipse: Oxygen Java: 1.8 The maps are an interface. A map contains values based on the key, for example, key and value pair. Each pair of key and value is known as an entry. Both the key and values are objects. A map cannot contain duplicate keys, it must be unique, but the value …

13.04. Maps Read More »

13.01. Sets

Sets Eclipse: Oxygen Java: 1.8 The usage of sets is shown here. The sets are a unique type of data structure mostly used because it does not allow the repetition of the elements. The basic operations of sets are shown here. In the following example, HashSet is created and elements are stored in the set …

13.01. Sets Read More »

13.07. Some important techniques

Some important techniques Eclipse: Oxygen Java: 1.8 The tutorial shows some important techniques that can be implemented and that save time, for example. The addAll()  method for queues and sets and also implementing the binary search in the same also explore the comparable interface for lists. The following program demonstrates how to create a list …

13.07. Some important techniques Read More »

13.06. Equals and hashcode methods

Equals and hashcode methods Eclipse: Oxygen Java: 1.8 In this tutorial, we will learn “Equals and hashcode methods”. The equals method is used to compare two objects whether they have the same characteristics. This is done by comparing two hashcodes of the object which is also explained in this tutorial. The hashcode is like an …

13.06. Equals and hashcode methods Read More »

13.05. TreeMap

TreeMap Eclipse: Oxygen Java: 1.8 In Java TreeMap is the kind of map data, but the natural order of the keys is preserved. Therefore TreeMap implements the map interface and navigable map along with the abstract class. In the following program, we are making use of HashMap based on lectures. The key symbolizes the serial …

13.05. TreeMap Read More »

14.01. Multithreading Overview

Threads Overview Eclipse: Oxygen Java: 1.8 Threads perform a single task that belongs to a single process. The overview of threads is provided here along with the states of the threads. It is controlled by java.lang.Thread class. A thread is a mini process within a process that can execute or perform operations independently. A thread …

14.01. Multithreading Overview Read More »

16.01. Data streams

Data streams Eclipse: Oxygen Java: 1.8 Data streams The stream is a sequence of data. It could be a sequence of input, output, or error streams. As the name suggests it performs input and output operations. It is used for the purpose of input and output respectively. In Java, streams are automatically created for us. …

16.01. Data streams Read More »

15.02. Predicates

Predicates Eclipse: Oxygen Java: 1.8 The predicate is a simple Boolean function that evaluates the function to true or false according to the assigned condition. The predicate is a functional interface and can, therefore, be used as the assignment target for a lambda expression or method reference. The following example demonstrates how to use IntPredicate. …

15.02. Predicates Read More »

16.03. Creating a directory in Java

Creating a directory in Java Eclipse: Oxygen Java: 1.8 Creating a directory in Java In this tutorial, we will deal with the creation of the file directory, which has the same procedure as the creation of the file. Therefore the same concepts are shown as the absolute and relative location. The following constructor takes a file …

16.03. Creating a directory in Java Read More »

16.04. Writing into files

Writing into files Eclipse: Oxygen Java: 1.8 Writing into files The file writing includes the use of Buffered Writer and File Writer in order to write any statement into the file. In the following program first, we create a file object. To write content into the file we must use “BufferedWriter”.  This is used to …

16.04. Writing into files Read More »

16.05. File deletion

File deletion Eclipse: Oxygen Java: 1.8 The concept of file deletion is shown here. This is done by a simple command of file.delete() method. The Java File delete() method can be used to delete files, it will return a boolean value. It returns true if the file is deleted; false if failed. In the following …

16.05. File deletion Read More »

16.06. Try with resources

Try with resources Eclipse: Oxygen Java: 1.8 The try with resources is a command that whenever we allocate some resources, for example, Assigning a resource to take input from the Scanner class. If the user fails to close the resource, then it leads to a resource leak which could prove dangerous to the execution of …

16.06. Try with resources Read More »

16.07. Serialization of Objects

Serialization of Objects Eclipse: Oxygen Java: 1.8 Serialization of Objects It is the converting of Java objects into byte streams and deserialization, as the name suggests, in a contrast to it. Stated differently, serialization is the conversion of a Java object into a static stream (sequence) of bytes which can then be saved to a …

16.07. Serialization of Objects Read More »

15.01. Lambda expression

Lambda expression Eclipse: Oxygen Java: 1.8 The lambda expression is used mainly to execute programs making the programs shorter. Therefore, previously we used classes to implement functions defined in the interfaces, but here we can directly write the function declarations with the help of the lambda expression. In the following program, we demonstrate how to …

15.01. Lambda expression Read More »

14.16. Deadlock

Deadlock Eclipse: Oxygen Java: 1.8 The deadlock is a condition in which the resources cannot be allocated to two or more threads in the current resources requirement, which leads to a state of a halt as the resources cannot be released nor can be acquired therefore this brings the processing to a complete halt. So …

14.16. Deadlock Read More »

14.12. Thread pools

Thread pools Eclipse: Oxygen Java: 1.8 This tutorial is about a thread pool that is a software design pattern for achieving concurrency of execution in a computer program. Often, also called a replicated workers or worker-crew model, a thread pool maintains several threads waiting for tasks to be allocated for concurrent execution by the supervising program. In the following program, …

14.12. Thread pools Read More »

14.13. Countdown Latch

Countdown Latch Eclipse: Oxygen Java: 1.8 This tutorial deals with the countdown latch. The basic use of this is that we can place the thread that we want to execute after a certain number of threads. This can be done by setting the countdown number to the number of threads after which we want the …

14.13. Countdown Latch Read More »

14.14. Blocking Queue

Blocking Queue Eclipse: Oxygen Java: 1.8 The blocking queue is used as a container for objects when the threads are inserting the objects and other threads are taking the objects out of them. The threads can only continue inserting the objects until a specific limit and take out or use the resources until a specific …

14.14. Blocking Queue Read More »

14.15. Reentrant lock

Reentrant lock Eclipse: Oxygen Java: 1.8 The Reentrant lock is a mutually exclusive lock. This lock means that the lock can be accessed by the thread that owns it or controls it more than once. Therefore, if any thread has access to that lock, no other thread, except that thread, can use that. This is …

14.15. Reentrant lock Read More »

14.07. Static synchronization

Static synchronization Eclipse: Oxygen Java: 1.8 The concept of static synchronization is shown here. For the issue regarding the inconsistency caused due to the multiple objects accessing the synchronized block causes an error, hence by declaring the function as static, we can avoid the same. Therefore, we can directly access the methods by the class …

14.07. Static synchronization Read More »

14.08. Usage of volatile keyword

Usage of volatile keyword Eclipse: Oxygen Java: 1.8 The usage of volatile keyword is used to declare the variables that will be modified by different threads. All changes in the variable will be directly written back to the memory. This keyword cannot be applied to class or method. It can only be used with a …

14.08. Usage of volatile keyword Read More »

14.09. Wait and notify

Wait and notify Eclipse: Oxygen Java: 1.8 The basic concept of wait and notify is explained in this tutorial. It tells the calling thread to get rid of the lock and go to sleep until some other threads enter the same monitor and calls notify() method. The wait() method releases the previous lock and reacquires …

14.09. Wait and notify Read More »

14.10. Interrupt

Interrupt Eclipse: Oxygen Java: 1.8 The basic concept of interrupt is that it stops the thread that is in an idle state by showing the interrupted exception. Therefore it can be given a chance to execute in case of a long wait or sleep functions. Suppose there are two threads and If one of the …

14.10. Interrupt Read More »

14.11. Join overview

Join overview Eclipse: Oxygen Java: 1.8 The joining method is an optimal solution to the problem of inconsistency that occurs due to threads not having a proper order. The join method is used to notify that the thread will wait until the execution of the given thread before execution. Here we have started the two …

14.11. Join overview Read More »

14.06. Synchronized block

Synchronized block Eclipse: Oxygen Java: 1.8 The synchronized block is the basic synchronization for a certain code that needs to be synchronized. It means that there might be code where no need for synchronization, then due to applying the synchronized method that the execution of the program is slowed down. Therefore, this problem is improved …

14.06. Synchronized block Read More »

14.05. Synchronized method

Synchronized method Eclipse: Oxygen Java: 1.8 Synchronized method Synchronization is the ability to control the access of multiple threads to any shared resource. Types of Synchronization Synchronized method Synchronized block Static synchronization Let us discuss the synchronized method The synchronized method is used to put a lock on a single object accessing the same entity …

14.05. Synchronized method Read More »

14.02. Creating threads by extending the thread class

Creating threads by extending the thread class Eclipse: Oxygen Java: 1.8 This tutorial offers a basic introduction to multithreading. This tutorial shows the basic execution of the program with multiple threads. The threads that have several unique properties, such as parallel execution, are shown here. In the following program, we Extend “Thread class”. Then override …

14.02. Creating threads by extending the thread class Read More »

12.03. Type parameters

Type parameters Eclipse: Oxygen Java: 1.8 As developers, we always strive to create reusable and flexible applications with different types of data. Therefore, by using generics, we can do that. But here there are also several types of parameters available, such as the element, the key value, the number, etc. In the following example, Class …

12.03. Type parameters Read More »

12.01. Generics in Java

Generics in Java Eclipse: Oxygen Java: 1.8 Generics is a facility of generic programming that was added to Java in 2004 within version J2SE 5.0. It allows a type or method to operate on objects of various types while providing security of compile-time type. Advantages Reusability (You can compose a class or an interface once …

12.01. Generics in Java Read More »

11.01. ArrayList

ArrayList Eclipse: Oxygen Java: 1.8 Here all the basic operations associated with the Arraylists are shown such as append the name to the ArrayList, remove by position, remove by the string ( case sensitive) and also get the position of the element given. The following example demonstrates: Creation of an ArrayList Addition of new elements …

11.01. ArrayList Read More »

10.01. What’s an Array

What’s an Array Eclipse: Oxygen Java: 1.8 An array is basically a collection, an arrangement of similar datatypes entities. It is used to assign a common variable name for accessing a large number of entities of the same datatype by the difference of the index number. Data stored in an array has contiguous memory locations. …

10.01. What’s an Array Read More »

09.04. Inner Classes

Inner Classes Eclipse: Oxygen Java: 1.8 Here in Java Inner classes is the concept where we want to add more encapsulation to the given code. When we declare a class inside a class then the inside class can access all the private members in addition to the inner class can be hidden from the outside …

09.04. Inner Classes Read More »

09.02. Abstract Classes

Abstract Classes Eclipse: Oxygen Java: 1.8 In Java, Abstract classes are created by using the abstract keyword in the class definition. Syntax

Some facts related to Abstract class in Java An abstract class is used to achieve abstraction. A class that is declared with the abstract keyword is known as an abstract class in Java. …

09.02. Abstract Classes Read More »

09.17. Strings in Java

Strings in Java Eclipse: Oxygen Java: 1.8 A Sequence of characters inside double quotes is called String, for e.g., “Java” String is the sequence of 4 characters. Initialization of String variable In the below example, we will create a String. Here var is the reference of data “Hello World” of type String. String var = “Hello World”; Unicode symbols …

09.17. Strings in Java Read More »

09.08. Anonymous Inner Class

Anonymous Inner Class Eclipse: Oxygen Java: 1.8 In Java, an anonymous inner class is a class that is defined and instantiated simultaneously without explicitly providing a name for the class. It is a convenient way to implement interfaces or extend classes on-the-fly, right at the point of use. This powerful feature allows for concise and …

09.08. Anonymous Inner Class Read More »

09.06. Local Inner Class

Local inner class Eclipse: Oxygen Java: 1.8 Working with the local inner class which is defined or structured inside the outer class is shown here. Here the example of door and lock is shown as a real-life example. In Java, we can write a class within a method it is called a local inner type. Like …

09.06. Local Inner Class Read More »

09.04. Types of Nested Class

Types of nested classes Eclipse: Oxygen Java: 1.8 The types of nested classes are categorized here. Category of the nested class, we have already seen in the inner class and further types will be seen in the forthcoming articles. In Java, It is possible to specify, a class within another class, such classes are known …

09.04. Types of Nested Class Read More »

08.05. Composition

Composition Eclipse: Oxygen Java: 1.8   The composition is the core concept of object-oriented programming. The composition is the design technique to implement a has-a relationship between different types of objects/classes. We can use Java inheritance or object composition in Java for code reuse. Difference between inheritance and composition? In Java, Inheritance is suitable only when …

08.05. Composition Read More »

08.04. Working with Inheritance

Working with Inheritance Eclipse: Oxygen Java: 1.8 Inheritance Inheritance is the process of defining a new class based on an existing class where a child class acquires the properties of the parent class. For using the properties of a class (superclass) we need to create a class(subclass) and then use the ‘extends’ keyword to use …

08.04. Working with Inheritance Read More »

08.03. Understanding Inheritance

Understanding Inheritance Eclipse: Oxygen Java: 1.8 Inheritance Inheritance is used to store information and manage the information in a hierarchical order. It is the process of defining a new class based on an existing class where a child class acquires the properties of the parent class. The subclass (Child/Derived class) inherits the properties of the …

08.03. Understanding Inheritance Read More »

05.05. Break and continue statement

Break and continue statement Eclipse: Oxygen Java: 1.8 In this tutorial, we will discuss the Break and Continue statement. Before knowing the continue instruction, let’s define the break instruction. Break statement Sometimes it is required to do terminate the loop, without verifying test expression. In such cases break statement can be used. The break statement …

05.05. Break and continue statement Read More »

09.22. Enum in Java

Enum in Java Eclipse: Oxygen Java: 1.8 Enum is used to define a set of constants in java. Not only constant by it could also call any method, constructor associated with it. Which will be seen further in the tutorial. We should always use enum when a variable (especially a method parameter) can only take …

09.22. Enum in Java Read More »

11.05. Stack Methods

Stack methods Eclipse: Oxygen Java: 1.8 The useful stack methods that are a push(), pop(), and search() along with empty() methods are shown here. These methods are used to perform basic operations. In this tutorial, users will learn how to define a stack along with the use of all the above-stated methods. The following program …

11.05. Stack Methods Read More »

11.03. Collections Framework Overview

Collections Framework Overview Eclipse: Oxygen Java: 1.8 The collections framework is a set of useful interface and classes of use data structures such as a Map, List, etc. The Collection in Java is a framework that provides an architecture for storing and manipulating a group of objects. The Java Collection framework provides many interfaces like …

11.03. Collections Framework Overview Read More »

11.02. Autoboxing and Unboxing

Autoboxing and Unboxing Eclipse: Oxygen Java: 1.8 In this tutorial, we will learn about what is autoboxing and unboxing. The ArrayList is very efficient, as we have seen, but it includes some more interesting features that are seen in this tutorial. ArrayList only accepts the elements that are objects of a class such as an …

11.02. Autoboxing and Unboxing Read More »

10.03. Issues with Array

Issues with Array Eclipse: Oxygen Java: 1.8 There are many issues with the array, such as the memory factor, where the user once assigned any memory to the array cannot add or change the memory and append any other element to it. There are significant weaknesses when working with arrays, these includes: Fixed-size (We can …

10.03. Issues with Array Read More »

09.20. User Defined Exception

User-defined exception Eclipse: Oxygen Java: 1.8 User defined exception is manually defined by the users as suggested by the name. For example, while developing a simple HTML form we want to throw an exception when the password length is less than 8 than such exceptions are used. Syntax

In the following program, we have …

09.20. User Defined Exception Read More »

09.19. Throw and Throws

Throw and Throws Eclipse: Oxygen Java: 1.8 Throw and Throws Throws are used to suppress the error if the user doesn’t want to specify the try and catch block. Note that this doesn’t handle the error only suppresses it. It should be used only when the developer is sure that the error doesn’t occur. The …

09.19. Throw and Throws Read More »

09.18. Finally Block

Finally block Eclipse: Oxygen Java: 1.8 The finally block is the block that always gets executed no matter the program throws an exception or not. But we have to follow some basic conditions that the catch blocks always is after the throw block. This could be used to execute an important segment of code we …

09.18. Finally Block Read More »

09.16. Exception Handling

Exception handling Eclipse: Oxygen Java: 1.8 Exception Handling is done to avoid errors that occur during the runtime of the program. Hence in such cases, we take care of such exceptions to prevent the program from ending abruptly. Several things can give rise to the following kinds of exceptions such as the file not found …

09.16. Exception Handling Read More »

09.15. Access Modifier

Access modifier Eclipse: Oxygen Java: 1.8 Access modifiers in Java help to restrict the scope of a class, constructor, variable, method, and data member. There are four types of access modifiers: Private Public Protected Default – No keyword is required The private access modifier is specified using the private keyword. It is accessible only within …

09.15. Access Modifier Read More »

09.14. Scope in Java

Scope in Java Eclipse: Oxygen Java: 1.8 The scope of the variable is defined by the passage of the variable in which it can be used and accessed. The scope is an important concept in the OOPS. We have learned that public, private, protected, and default which is the package. These are the scope operators …

09.14. Scope in Java Read More »

09.13. Packages

Packages Eclipse: Oxygen Java: 1.8 It is a way to group many classes belonging to a specific project.  A package is like a folder of similar things such as music or a folder of movies. The package adds a different level of inheritance, this level of inheritance is by default applied to all the members …

09.13. Packages Read More »

09.10. User Input

User Input Eclipse: Oxygen Java: 1.8 This tutorial tries to take information from the user using the Scanner class. There were several types of datatype as we have seen previously. Sometimes, we can face a situation where we need to get information from the user at runtime. We use the “Scanner” class to accept user …

09.10. User Input Read More »

09.09. Advantage of Inner Class

An advantage of Inner Class Eclipse: Oxygen Java: 1.8 This tutorial depicts the Advantage of Inner Class as we have discussed so far in this series of tutorials. Inner classes are the concept where we want to add more encapsulation to the given code. When we declare a class within a class, the inner class can access …

09.09. Advantage of Inner Class Read More »

09.07. Anonymous Object

Anonymous Object Eclipse: Oxygen Java: 1.8 The anonymous object simply means creating a new Object without assigning it to a reference. Hence this could be used only once in the execution of a program as it is not referenced to any object. It is useful for writing implementation classes for listener interfaces in graphical programming. …

09.07. Anonymous Object Read More »

08.01. Classes Overview

Classes Overview Eclipse: Oxygen Java: 1.8 Classes and Objects are the basic building block of Object Oriented Programming language. The class can be created by using “class” keyword followed by a reference name. Syntax:

Classes are the blueprint of object creation. Classes are the user-defined implementation of real-life scenarios. A class defines the state …

08.01. Classes Overview Read More »

08.02. Constructor Overview

Constructor Overview Eclipse: Oxygen Java: 1.8 Constructor Introduction: In Java, Constructor is a special method, which is invoked when an object of the class is created. It is used to initializing the class variables. There are some rules for construction creation: A constructor always has the same name as the class name. A constructor is …

08.02. Constructor Overview Read More »

06.01. Methods in Java

Method in Java Eclipse: Oxygen Java: 1.8 In Java, Method is a block of code, which performs a specific task. It is also known as a function procedure. “Methods” are blocks of code that can be used repeatedly by the programmer to reduce the complexity (length) of the code. There are various types of methods …

06.01. Methods in Java Read More »

05.06. Nested Loops

Nested Loop Eclipse: Oxygen Java: 1.8 A nested loop is a loop within a loop, an inner loop within the body of an outer one. In this tutorial, we will learn the syntax for nested loop and understand the examples. Program In the following statement for loop is inside the body of another for a …

05.06. Nested Loops Read More »

05.04. Do while loop

Do While Loop Eclipse: Oxygen Java: 1.8 Java allows you to create a do-while loop, which likes almost similar to a while loop, is a structure of the repetition control with a termination condition and statements, or block of statement. Difference between while and do-while loop In Java While loop, the expression is evaluated at …

05.04. Do while loop Read More »

05.03. While Loop

While Loop Eclipse: Oxygen Java: 1.8 While loop in Java is a structure that executes a statement of code multiple times until the boolean expression is false. In While loop, boolean expression is evaluated before the execution of code. If the boolean expression is evaluated as true, then only the execution of code starts, and …

05.03. While Loop Read More »

05.02. For loop

For Loop Eclipse: Oxygen Java: 1.8 This tutorial deals with the implementation of for loop. The for loop deals with executing the code continuously over a given range of values specified by the user. In a programming language, a loop means repeating the execution to the instruction or instruction block with respect to the condition …

05.02. For loop Read More »

05.01. Switch case

Switch Case Eclipse: Oxygen Java: 1.8 Switch case statement in java is the conditional statement that executes one statement out of many statements when the condition is matched. Default statement is executed when none of the conditions is matched. Syntax

Example Switch case always works on condition, here condition is int x = 3. …

05.01. Switch case Read More »

04.02. Ternary Operator in Java

Ternary Operator In Java Eclipse: Oxygen Java: 1.8 Ternary operator works on three operands. It returns a value based on a condition that evaluates either true or false statement. True and false statements are also an expression that you want to evaluate. If the expression is true it evaluates expression true otherwise it evaluates the …

04.02. Ternary Operator in Java Read More »

04.03. Assignment Operators

Assignment Operators Eclipse: Oxygen Java: 1.8 Assignment operators are a binary operator that is used to assign a value of an expression to a variable on the left-hand side of the operator, with the result of the value on the right-hand side of the equation. In Java, the assignment operator are: =,+=,-+,*=,/=,%= There are following …

04.03. Assignment Operators Read More »

03.03. Variable and Data Type

Variable and Data Type Variable is a space in memory where we can store data. It helps to access the data easily. Data Type A data type defines the size and type of information stored in a variable. Data types help in memory management. It helps to assign the memory depending upon the type of data …

03.03. Variable and Data Type Read More »

03.06. Type Casting

Type Casting Eclipse: Oxygen Java: 1.8 In Java, Type Casting is a process of converting a variable of one data type into another. Typecasting is of two types: Implicit typecasting. Explicit typecasting. Implicit typecasting   Implicit type casting is also known as Widening or Automatic typecasting. When a small range data type variable is converted …

03.06. Type Casting Read More »

04.01. Arithmetic Operators

 Arithmetic Operators Eclipse: Oxygen Java: 1.8 Java provides a rich set of operators to manipulate a variable. Operators are the symbols in Java that perform a specific operation on many operands and returns the output. Before knowing the arithmetic operators, let us know the type of operator. Java operators are divided into the following groups: Arithmetic …

04.01. Arithmetic Operators Read More »

03.05. Primitive data types

Primitive Data Types Eclipse: Oxygen Java: 1.8 Java supports eight primitive data types.  These are the basic and predefined data type of the programming language.  Java determines the size of each primitive data types, it cannot be changed. Primitive data types are represented by reserved keywords. The primitive data type is divided into the following …

03.05. Primitive data types Read More »

03.02. Hello world in Java

Our First Java Program Eclipse: Oxygen Java: 1.8 In a programming language, it is essential that one must start with the basics to understand the concept. The most common program which helps to understand programming concepts is the Hello World program. Also, our first program in general. Following is a “hello world” program in Java, …

03.02. Hello world in Java Read More »

01.01. History of Java

History of Java The history of Java began in the early 1990s when Sun Microsystems’ developers, led by James Gosling, started developing a new programming language for embedded devices. They wanted a language that could run on any device regardless of its hardware or operating system and was easy to learn with a syntax similar …

01.01. History of Java Read More »

03.01. 50 Keywords of Java

50 Keywords of Java Keywords are reserved words in Java that have specific meanings and cannot be used for any other purpose, such as variable names or method names. Java has a total of 50 keywords, which are used to define the syntax and structure of Java programming language. Here’s a list of Java keywords: …

03.01. 50 Keywords of Java Read More »

11.11. Comparable Interface

Comparable Interface Eclipse: Oxygen Java: 1.8 Comparable Interface The comparable class is shown here. The syntax of the comparable class is unique to the others which include objects and the class. This class can be used for various purposes as shown in the tutorial. The Comparable interface is found in java.lang package. It contains only …

11.11. Comparable Interface Read More »

11.10. CompareTo Method Overview

CompareTo method overview Eclipse: Oxygen Java: 1.8 compareTo() method This is a very useful method in Java. The compared methods are used to compare TWO OBJECTS and not two primitive datatypes. The output of the compared to the method is explained on the basis of some arguments. If we want to compare two primitive datatypes, …

11.10. CompareTo Method Overview Read More »

11.09. Sorting and Reversal of Elements

Sorting and reversal of elements Eclipse: Oxygen Java: 1.8 The sorting and reversal of elements from the Collections are shown in the article by the built-in functions in the collection frameworks. The following example demonstrates the alphabetical sorting of the List of country names. sort() method will sort the elements (country names) of the  LinkedList using …

11.09. Sorting and Reversal of Elements Read More »

11.08. Iterators in Java

Iterators in Java Eclipse: Oxygen Java: 1.8 The list of iterators in Java is shown here. The iterators are the same as for the foreach loop and do not have any additional features compared to the foreach loop. The list iterators have some interesting features like the previous one and more, which will be seen …

11.08. Iterators in Java Read More »

11.07. List Interface

List Interface Eclipse: Oxygen Java: 1.8 List interface in Java The interface is an outline of the methods for a particular class to implement. Here the ArrayList, LinkedList implements the list interface, therefore, you can use the methods that are defined in the List interface as shown here. In the following example, List <> interface …

11.07. List Interface Read More »

11.06. LinkedList

LinkedList Eclipse: Oxygen Java: 1.8 A LinkedList is considered as a data structure similar to any other data structure like arrays, stacks, and queues. Here, every node is interconnected to the next node through a memory address link. A LinkedList has three elements namely: Head Nodes Tails This is one of the most useful data …

11.06. LinkedList Read More »

08.07. Encapsulation

Encapsulation Eclipse: Oxygen Java: 1.8 In Java, Encapsulation is the process of binding the class members (variables and methods) into a single unit. It protects the data of class to be accessed from outside the class. In Encapsulation, we hide the implementation details from the outer class and provided them the controlled access to the …

08.07. Encapsulation Read More »

09.01. Interfaces

Interfaces Eclipse: Oxygen Java: 1.8 This tutorial deals with interfaces. The interfaces are somewhat similar to a class but have very interesting properties. Interfaces serve as an outline of the class ‘implementing it'(inherit). The members declared in it are public, static by default. Hence we can have a constructor for an abstract class (which will …

09.01. Interfaces Read More »

08.08. Polymorphism

Polymorphism Eclipse: Oxygen Java: 1.8 This tutorial deals with the concept of polymorphism. Polymorphism in simple words means to have multiple forms of a single entity. In the previous example when a note8 object call features methods by different scopes (class scope, one of Phone and one of SamsungNote8) we obtain different outputs.

  …

08.08. Polymorphism Read More »

08.06. Adding Functionality

Adding functionality Eclipse: Oxygen Java: 1.8 Adding functionality This tutorial deals with describing various functionalities of Composition. As described earlier in composition we can ‘inherit’ objects which are used to reference the method or the attribute related to the class. The same concept is described here when the attributes of processor class are accessed by …

08.06. Adding Functionality Read More »

04.09. Precedence of Java Operators

Precedence of Java Operators Eclipse: Oxygen Java: 1.8 In Java, operators have different levels of precedence, which determines the order in which operations are performed. The operator with higher precedence is evaluated first, followed by operators with lower precedence. If two operators have the same precedence, their evaluation order is determined by their associativity. The …

04.09. Precedence of Java Operators Read More »