Category: Data Types, Variables, and Arrays

Data Types, Variables, and Arrays

toString() Metod in Java

toString() Metod in Java

If you want to represent any object as a string, toString() method comes into existence. The toString() method returns the string representation of the object. If you print any object, java compiler internally invokes...

Arrays

Arrays

An array is simply a sequence of either objects or primitives that are all the same type and are packaged together under one identifier name. Arrays are defined and used with the square-brackets indexing...

Type Casting

Type Casting

There are some conditions where we have to convert one data type to the other data type. In programming languages these conversions are referred to as Type Casting. Java type casting can be classified...

Variables

Variables

Variables are the basic entities in a program that are used to identify different values. A variable can be declared as : type variable-name; Initialize a variable When declaring two or more variables of...

Literals

Literals

In Java, literals refer to fixed values that are represented in their human-readable form For example, the number 100 is a literal. Literals are also commonly called constants. Below is the basic Java literals...

Java – Basic Data Types

Java – Basic Data Types

Integers Java defines four integer types: byte, short, int, and long. Type Width in Bits Range byte 8 –128 to 127 short 16 –32,768 to 32,767 int 32 –2,147,483,648 to 2,147,483,647 long 64 –9,223,372,036,854,775,808...