Skip to main content

Posts

Operators

Java | Operators: Operators are used for performing calculations. List of Operators:          Additional Operator: Add two values with this additional operator, it is denoted by '+'.                                                      Ex: 100 +  1.         Subtraction Operator: Minus one value from another value with this operator, it is denoted by '-'.                                                       Ex: 100 - 1.         Multiplication Operator: Multiply two values with this operator, it is denoted by '*'.                                              Ex: 100 * 1.         Division Operator: Divide one value from another value with this operator, it is denoted by '/'.                                              Ex: 100 / 1.         Modulo Operator: Remainder of dividing one value with another value, it is denoted by '%'. Here is the Code: import java.io.*; class Main { public static void main (String[] args) {     // Addition     Syst

Relational operators

Java | Relational Operators: Relational operators are using for compare the data. List of Relational Operators: .     Less Than: This operator checks if left value is less than right value or not. it is denoted by '<'.                                      Ex: 1 < 2.     Greater Than: This operator checks if left value is greater than right value or not. it is denoted by '>'.                                      Ex: 1 > 2.       Equal to: This operator is using to check if both values are equal or not. it is denoted by '=='.                                     Ex: 1 == 2.       Not Equal to: This operator is using to check if both values are not equal or not. it is denoted by '!='.                                      Ex: 1 != 2.       Less Than or Equal to: This operator checks if left value is less than or equal with right value or not. it is denoted by '<='.                                             Ex: 1 <= 2.         Great

Variables

Java | Variables: Variables are using to store the data. Details of Variables:     Variable Declaration and Initialization: Create the variable and assign the value to it.                                   Ex: int i = 1.     Modification of Variables: Variables can modify by doing operators on them.                              Ex: i = i + 2.     Types of Variables: Variable types are integer, string, float/double and boolean.                                      Ex: 1 is integer, "Java" text with double quotes is string, 1.43 number with decimal values are float/double and true/false is boolean.  Here is the Code: import java.io.*; class Main { public static void main (String[] args) {     // Declaration and Assigning     int i = 1;     System.out.println(i);     // Modification     i = i + 2;     System.out.println(i);     // Types     double j = 1.43;     System.out.println(j);     String s = "Java";     System.out.println(s);     boolea

Data types

Java | Data Types: Java data types are strings, numbers and boolean values. One by One: Strings:          The strings are nothing but collection of characters and also text is in between double quotes.          Numbers:         The numbers are sub divided into int, float, double and long.         Ex: 10 is int, 3.14F is float, it takes up to 7 decimal positions, 2.414343 is double,            it takes up to 15 decimal positions and 1234565432112345L is long Boolean:          There are two boolean values, those are true and false. Here is the Code: import java.io.*; class Main { public static void main (String[] args) {      // String      System.out.println("cool");      // Integer  System.out.println(1); // float takes up to 7 decimal positions System.out.println(3.1421242323243554545F); // double takes up to 15 decimal positions System.out.println(2.4143245423242342321); // long  System.out.println(12345432123454321L); // boolean System.ou

Hello World

Java | Hello World: Most well know beginning word "Hello World" for any programming language.  Here is the Code: import java.io.*; class HelloWorld { public static void main (String[] args) { System.out.println("Hello World"); } }       Output: Hello World. Here is the Video: