Author: misamaliraza94

  • Date and Time

    Java provides the Date class available in java.util package, this class encapsulates the current date and time. The Date class supports two constructors as shown in the following table. Sr.No. Constructor & Description 1 Date( )This constructor initializes the object with the current date and time. 2 Date(long millisec)This constructor accepts an argument that equals the number of milliseconds…

  • Arrays

    Java provides a data structure, the array, which stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type. Instead of declaring individual variables, such as…

  •  Strings

    Strings, which are widely used in Java programming, are a sequence of characters. In Java programming language, strings are treated as objects. The Java platform provides the String class to create and manipulate strings. Creating Strings The most direct way to create a string is to write − Whenever it encounters a string literal in…

  • Characters

    Normally, when we work with characters, we use primitive data types char. Example However in development, we come across situations where we need to use objects instead of primitive data types. In order to achieve this, Java provides wrapper class Character for primitive data type char. The Character class offers a number of useful class (i.e., static)…

  • Numbers

    Normally, when we work with Numbers, we use primitive data types such as byte, int, long, double, etc. Example However, in development, we come across situations where we need to use objects instead of primitive data types. In order to achieve this, Java provides wrapper classes. All the wrapper classes (Integer, Long, Byte, Double, Float, Short)…

  • Decision Making

    Decision making structures have one or more conditions to be evaluated or tested by the program, along with a statement or statements that are to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false. Following is the general form…

  • Loop Control

    There may be a situation when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on. Programming languages provide various control structures that allow for more complicated execution paths. A loop statement allows…

  • Basic Operators

    Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups − Arithmetic Operators Relational Operators Bitwise Operators Logical Operators Assignment Operators Misc Operators The Arithmetic Operators Arithmetic operators are used in mathematical expressions in the same way that they are used in algebra. The…

  • Modifier Types

    Modifiers are keywords that you add to those definitions to change their meanings. Java language has a wide variety of modifiers, including the following − Java Access Modifiers Non Access Modifiers To use a modifier, you include its keyword in the definition of a class, method, or variable. The modifier precedes the rest of the…

  • Variable Types

    A variable provides us with named storage that our programs can manipulate. Each variable in Java has a specific type, which determines the size and layout of the variable’s memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable. You must…