Category Archives: Java

Double Brace Initialization in Java

When we use a collection in your code, we typically do following. Declare a variable for a temporary collection. Create a new empty collection and store a reference to it in the variable. Put things into the collection. Pass the collection to the method. For example: Output: [one, two, three] Above are normal steps we… Read More »

Operators in Java

Java provides many types of operators which can be used according to the need. They are classified based on the functionality they provide. Some of the types are- Arithmetic Operators Unary Operators Assignment Operator Relational Operators Logical Operators Ternary Operator Bitwise Operators Shift Operators instance of operator Precedence and Associativity Interesting Questions Lets take a… Read More »

Java.Lang.Long class in Java

Long class is a wrapper class for the primitive type long which contains several methods to effectively deal with a long value like converting it to a string representation, and vice-versa. An object of Long class can hold a single long value. There are mainly two constructors to initialise a Long object- Long(long b): Creates… Read More »

Java.lang.Integer class in Java

Integer class is a wrapper class for the primitive type int which contains several methods to effectively deal with a int value like converting it to a string representation, and vice-versa. An object of Integer class can hold a single int value. Constructors: Integer(int b): Creates a Integer object initialized with the value provided. Syntax… Read More »

Interfaces and Inheritance in Java

Prerequisites: Interfaces in Java, Java and Multiple Inheritance A class can extends another class and/ can implement one and more than one interface. Output; Welcome: inside the method m1 Welcome: inside the method m2 Interface inheritance : An Interface can extend other interface. Output: Rohit JIIT An interface can also extend multiple interfaces. Output: Rohit… Read More »

Java.Lang.Short class in Java

Short class is a wrapper class for the primitive type short which contains several methods to effectively deal with a short value like converting it to a string representation, and vice-versa. An object of Short class can hold a single short value. There are mainly two constructors to initialise a Short object- Short(short b): Creates… Read More »

Java.Lang.Byte class in Java

Byte class is a wrapper class for the primitive type byte which contains several methods to effectively deal with a byte value like converting it to a string representation, and vice-versa. An object of Byte class can hold a single byte value. There are mainly two constructors to initialise a Byte object- Byte(byte b): Creates… Read More »

Java.Lang.Double class in Java

Double class is a wrapper class for the primitive type double which contains several methods to effectively deal with a double value like converting it to a string representation, and vice-versa. An object of Double class can hold a single double value. There are mainly two constructors to initialize a Double object- Double(double b) :Creates… Read More »

Java.Lang.Float class in Java

Float class is a wrapper class for the primitive type float which contains several methods to effectively deal with a float value like converting it to a string representation, and vice-versa. An object of Float class can hold a single float value. There are mainly two constructors to initialise a Float object- Float(float b: Creates… Read More »

Java.net.HttpURLConnection Class in Java

HttpURLConnection class is an abstract class directly extending from URLConnection class. It includes all the functionality of its parent class with additional HTTP specific features. HttpsURLConnection is another class which is used for the more secured HTTPS protocol. Where is it used? It is one of the popular choices among the Java developers for interacting… Read More »