1. Variables are containers that hold values during program execution and have a data type. There are local, instance, and static variables and primitive and non-primitive data types.
2. Comments are lines of code that are not executed and include single line, multi-line, and documentation comments.
3. Operators are symbols that perform operations like +, -, *, /. Operator types include unary, arithmetic, shift, relational, bitwise, logical, ternary, and assignment.
1. Variables are containers that hold values during program execution and have a data type. There are local, instance, and static variables and primitive and non-primitive data types.
2. Comments are lines of code that are not executed and include single line, multi-line, and documentation comments.
3. Operators are symbols that perform operations like +, -, *, /. Operator types include unary, arithmetic, shift, relational, bitwise, logical, ternary, and assignment.
1. Variables are containers that hold values during program execution and have a data type. There are local, instance, and static variables and primitive and non-primitive data types.
2. Comments are lines of code that are not executed and include single line, multi-line, and documentation comments.
3. Operators are symbols that perform operations like +, -, *, /. Operator types include unary, arithmetic, shift, relational, bitwise, logical, ternary, and assignment.
1. Variables A variable is a container which holds the
value while the Java program is executed. A variable is assigned with a data type. Variable is a name of memory location. There are three types of variables in java: local, instance and static. There are two types of data types in Java: primitive and non-primitive. 2. Comments The Java comments are the statements in a program that are not executed by the compiler and interpreter. There are three types of comments in Java; Single Line Comment, Multi Line Comment, Documentation Comment 3. Operators In operator in Java is a symbol that is used to perform operations. For example: +, -, *, / etc. It is hard for me to understand the types of operators in Java which are given below: Unary Operator, Arithmetic Operator, Shift Operator, Relational Operator, Bitwise Operator, Logical Operator, Ternary Operator and Assignment Operator. 4. Switch The Java switch statement executes one statement from multiple conditions. It is like if-else-if ladder statement. The switch statement works with byte, short, int, long, enum types, String and some wrapper types like Byte, Short, Int, and Long. Since Java 7, you can use strings in the switch statement. 5. For loop The Java for loop is used to iterate a part of the program several times. If the number of iteration is fixed, it is recommended to use for loop. There are three types of for loops in Java. Simple for Loop, For-each or Enhanced for Loop, Labeled for Loop 6. While loop The Java while loop is used to iterate a part of the program repeatedly until the specified Boolean condition is true. As soon as the Boolean condition becomes false, the loop automatically stops. The while loop is considered as a repeating if statement. If the number of iteration is not fixed, it is recommended to use the while loop. 7. Method In general, a method is a way to perform some task. Similarly, the method in Java is a collection of instructions that performs a specific task. It provides the reusability of code. We can also easily modify code using methods. 8. Break When a break statement is encountered inside a loop, the loop is immediately terminated and the program control resumes at the next statement following the loop. The Java break statement is used to break loop or switch statement. It breaks the current flow of the program at specified condition. In case of inner loop, it breaks only inner loop. We can use Java break statement in all types of loops such as for loop, while loop and do-while loop. 9. Continue The continue statement is used in loop control structure when you need to jump to the next iteration of the loop immediately. It can be used with for loop or while loop. The Java continue statement is used to continue the loop. It continues the current flow of the program and skips the remaining code at the specified condition. In case of an inner loop, it continues the inner loop only. We can use Java continue statement in all types of loops such as for loop, while loop and do-while loop. 10. If else… he Java if statement is used to test the condition. It checks Boolean condition: true or false. There are various types of if statement in Java; if statement, if-else statement, if-else-if ladder, nested if statement