Found 10075 Articles for Object Oriented Programming

Java Program to Illustrates Use of Static Inner Class

Sakshi Ghosh
Updated on 11-Aug-2023 14:30:01
Here, we will demonstrate the usage of static inner class using the Java program. Before diving deep into the topic, let us get acquainted with the term Static Inner Class . Static Inner Class An inner class is the one, which is defined within another class. A Static Inner Class is a nested class that is a static member of the outer class. Other static members can be used to access it without first instantiating the outer class. A static nested class lacks access to the instance variables and methods of the outer class, much like static member’s java. Example ... Read More

Java Program to illustrate Total Marks and Percentage Calculation

Sakshi Ghosh
Updated on 11-Aug-2023 14:28:54
We will demonstrate how total marks and Percentages are calculated using Java programs. The term total marks refer to the summation of all the available marks, while the term percentage refers to the number obtained by dividing the calculated marks by total marks and multiplying the resultant by 100. percentage_of_marks = (obtained_marks/total_marks) × 100 Example 1 This is a Java program to demonstrate how total marks and percentages are calculated. // Java Program to demonstrate how is Total marks and Percentages calculated import java.io.*; public class TotalMarks_Percent1 { public static void main(String[] args){ int n = 8, t_marks ... Read More

Java Program to illustrate the Usage of Hexadecimal

Sakshi Ghosh
Updated on 11-Aug-2023 14:24:07
Here, the usage of Hexadecimal shall be demonstrated through the Java Program. Let us get acquainted with the term Hexadecimal before seeing a Java program. The Hexadecimal is a type of number system that has a base value of 16. There are 16 symbols representing hexadecimal numbers. These symbols or values are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. Each digit represents a decimal value.  The hexadecimal numbers from 0 to 9 are equivalent to decimal numbers from 0 to 9. Further, A represents 10, B represents 11, C represents ... Read More

Java Program to Illustrate the Availability of Default Constructor of the Super Class to the Sub Class by Default

Sakshi Ghosh
Updated on 11-Aug-2023 14:04:10
Here, we will demonstrate the availability of the default constructor of the super class to the sub class by default through Java Program. Before diving deep into the topic, let us get acquainted with the term Constructor, Super class, and subclass. Constructor A special method in Java is considered for the initialization of an object. The name of the constructor is the same as the class name and it does not return anything. A default constructor is invoked by itself whenever an object is created using a new keyword. There are following three types of constructors in Java ... Read More

Java Program to Illustrate Escaping Characters in Regex

Sakshi Ghosh
Updated on 11-Aug-2023 13:03:31
Here, we will demonstrate escaping characters in Regex through Java Program. Before diving deep into the topic, let us get acquainted with the term Escaping Characters and Regex. Regex It is an acronym for a Regular expression. It is an API that offers users to define String patterns that are useful for finding, modifying, and editing strings. A couple of areas of strings where Regex is frequently used to define the limitations include email validation and passwords. The java.util.regex package encompasses regular expressions. Escape character When a character is preceded by a backslash (\), it includes numbers, alphabets, and ... Read More

How to Use Enumeration to Display Elements of Hashtable in Java?

Harischandra Prasad
Updated on 03-Aug-2023 15:15:00
A Hashtable is a powerful data structure in Java that allows programmers to store and organise data in key-value pairs. Many applications need retrieving and displaying entries from a Hashtable. In a Hashtable, any non-null object can serve as a key or a value. However, for successful storage and retrieval of items from the Hashtable, the objects used as keys must implement both the equals() method and the hashCode() method. These implementations ensure proper handling of key comparisons and hashing, enabling efficient management and retrieval of data within the Hashtable. Through the utilization of the keys() and elements() ... Read More

How to Use Different Row Methods to Get Number of Rows in Table using JDBC?

Harischandra Prasad
Updated on 03-Aug-2023 15:10:22
The ability to interact with databases is an important requirement for many software programs in this data-driven world. Java is a versatile and robust programming language that offers Java Database Connectivity (JDBC), an effective mechanism that enables smooth interaction with different database systems. JDBC is an API that offers a standardised interface for Java applications to communicate with databases. We can perform operations like querying, inserting, updating, and deleting data using it as a bridge between the Java application and the database. This article helps us to delve into the world of Java's JDBC API, enabling us ... Read More

Why do we need a collection framework in Java?

Way2Class
Updated on 01-Aug-2023 15:15:54
An Array is a collection of the same type of elements in a contiguous memory allocation. These are used to represent lists of things like numbers, strings etc. Syntax [] = new []; Algorithm To implement array follow these steps Step 1 − Selecting an appropriate data type suitable for each individual element that will populate your desired array should be carefully considered beforehand. Step 2 − Furthermore, determining the necessary capacity required by taking into account specific usage requirements will enable selection of an accurate and optimal array size. Step 3 − Declare an array variable. Step 4 ... Read More

Why does an online Judge crash during an online Programming Contest?

Way2Class
Updated on 01-Aug-2023 15:13:54
We all are well aware are that now-a-days various coding platforms include competitive codings, for example GeeksforGeeks, CodeChef, Codeforces, atCoder, SPOJ, HackerRank, HackerEarth, and many more where they supposed to code out by themselves by either attaching local editor file such as a sublime editor or by directly writing on their respective editors. So how are these test cases getting accessed or in an easy way we can say that our code is getting compiled and run? On these programming platforms for competitive programming online judges act as the backbone for code compilation and run. Online Judge To judge ... Read More

Left Shift Operator in Java

Way2Class
Updated on 01-Aug-2023 13:49:07
The execution of instructions in programming languages involves the operation of various symbols referred to as "operators." Operators tell computers what action/value evaluation should be performed throughout set codes. Arithmetic-based operates consist of performing essential calculations like addition/subtraction/multiplication/division. Played out with relational-oriented operates that indicate interactions between any two values and analyzes when one is greater/equal/less with regards to another value - showing its relevance under certain conditions. Logical-operates' primary role often includes merging diverse quality statements into significant arguments either as True/False statement criteria based on developers' intentions efficiently using all three indispensable operator types. Left Shift Operator in ... Read More
1 2 3 4 5 ... 1008 Next
Advertisements