Found 9326 Articles for Object Oriented Programming

Runtime JAR File in Java

Shriansh Kumar
Updated on 15-May-2023 16:48:29

528 Views

The full form of JAR is Java Archive File. Java provides this feature to bundle multiple java program files as well as their corresponding class files into one single unit. Perhaps, it is the only file format that can store audio, video, text files and so forth in one place. In this article, we will discuss how we can create and access a JAR file in Java. Java JAR File The need for data compression was felt to store and transmit large amounts of data without any hassle. For this purpose, a ZIP file was introduced that encouraged Java creators ... Read More

Program to Convert Byte Array to Writer in Java

Shriansh Kumar
Updated on 15-May-2023 16:45:00

209 Views

Byte Array can be said as the combination of byte and array. Byte is the smallest integer type and Array is a linear data structure that is used to store groups of elements of similar datatypes. This article will discuss a program to convert Byte Array to Writer in Java. Let’s understand the term Byte Array and Writer first. Byte Array and Writer Class Byte Array It is a type of array that stores a sequence of data of byte datatype. We will use the ‘getBytes()’ method to convert specified strings into sequences of characters and store them in a ... Read More

Rounding off errors in Java

Shriansh Kumar
Updated on 15-May-2023 16:42:51

591 Views

While writing codes we all do various mistakes that lead us to errors like overflow errors and syntax errors. Rounding-off error is one of the common errors that may result in a wrong solution for a given mathematical problem. Generally, this error occurs when we work with floating point numbers. In this article, we will explore the reason for this problem and try to find a way to get rid of this kind of error. Rounding off Errors Floating Point Types They are also known as real numbers and are used when the calculation requires fractional values. It represents numbers ... Read More

Rules For Variable Declaration in Java

Shriansh Kumar
Updated on 12-May-2023 17:52:12

831 Views

In any programming language, variables serve as a container that is used to store values. Before actually using a variable we need to declare it first. We can’t give any random names or symbols to it, although Java provides almost all the letters and symbols available for human and machine use. We will explore the naming conventions and set of rules for variable declaration in Java through this article. Variable Declaration in Java When it comes to declaring a variable, we need to define its type first, then name of the variable and an optional value. We can declare ... Read More

Student Grade Calculator using Java Swing

Shriansh Kumar
Updated on 12-May-2023 17:47:24

1K+ Views

Swing is a framework of Java that is used to develop window based applications. It provides a rich variety of GUI (Graphical User Interface) components that are lightweight and platform independent. Some of the classes of GUI components are JLable, JButton, JFrame, JCheckBox and so forth. In this article, we will build a simple student grade calculator using the components of Java Swing. Steps to create Student Grade Calculator using Java Swing To develop this application follow these steps − Step 1 Open your Netbeans IDE and create a new Java Application through the following path − File -> ... Read More

Simple Bill Splitter Application using Java Servlets

Shriansh Kumar
Updated on 12-May-2023 17:45:25

242 Views

Servlets are small java modules that are used on server side of a web connection to enhance the functionality of web server. All the methods and classes for creating a servlet are available in ‘javax.servlet’ and ‘javax.servlet.http’ packages. Hence, it is important to import them into your program before working with the servlet. In this article, we will develop a simple bill splitter application using Java Servlets. Before starting, make sure you have installed the NetBeans IDE and Apache Tomcat server. Steps to build Simple Bill Splitter To develop this application follow these steps − Step 1 Open your ... Read More

Separators in Java

Shriansh Kumar
Updated on 12-May-2023 17:41:53

2K+ Views

Separators are one of the building blocks of a Java program that helps us to differentiate the regions of the block of code and arrange groups of codes or statements. They help us in defining scopes of particular variables and methods. Have you ever missed a bracket while defining a method or semicolon at the end of a statement? We all do this silly mistake every time we code. In this article, we are going to explore the importance of these separators and what would be the consequences if we neglect them. Seperators available in Java Being a programmer we ... Read More

Sorting Elements of Arrays and Wrapper Classes that Already Implements Comparable in Java

Shriansh Kumar
Updated on 12-May-2023 17:29:57

203 Views

Java provides a variety of sorting algorithms and methods that can help us to sort arrays, lists or any collections. The comparable interface is an additional way that is useful when we want to sort custom objects by their natural ordering. For example, It sorts strings in dictionary order and numerics in numerical order. This interface is available in ‘java.lang’ package. In this article, we will create an array and arraylist and then, try to sort them to show that arrays and wrapper classes already implements Comparable Interface. Sorting elements of Arrays and Wrapper class We will use the following ... Read More

Sorting Custom Object by Implementing Comparable Interface in Java

Shriansh Kumar
Updated on 12-May-2023 17:27:45

461 Views

Java provides a variety of sorting algorithms and methods that can help us to sort arrays, lists or any collections. The comparable interface is an additional way that is useful when we want to sort custom objects by their natural ordering. For example, it sorts strings in dictionary order and numerics in numerical order. This interface is available in ‘java.lang’ package. In this article, we will learn the use of Comparable Interface through examples. Also, we discuss a few methods and classes of Collection Interface that are going to help us in sorting of custom objects using comparable interface. ... Read More

Sorting a 2D Array according to values in any given column in Java

Shriansh Kumar
Updated on 12-May-2023 17:26:18

933 Views

Array is a linear data structure that is used to store a group of elements with similar datatypes. It stores data in a sequential manner. Once we create an array we can’t change its size i.e. it is of fixed length. Suppose we have a 2D array of order M x M where M is the number of rows and columns. We have to sort the specified column of the given array. In this article, we will try to find the solution to the given problem. Sorting 2D Array according to column value Sorting means rearranging the elements of a ... Read More

Advertisements