Eclipse:
1. While creating the java project in eclipse project name must be like this: first letter of each word
should be capital letter
2. After creating the project you will find one folder called ‘src’ which means ‘source code’
3. And also we will resource library called ‘JRE’ – java run time environment
4. Package: package means just like a folder, separating the files based on the belongining
functionalities. We manage our classes and files in packages.
5. We must write our code in the form of class in java. We can’t write code without class in java.
6. Class name should have the capital letter for first letter in each word.
7. All the keywords should start with small letter ex: “package”, “class”, “public”
8. Inside the main method we will write our code, main method should be there in our program
and we can’t change the main method.
9. Comments in eclipse: when program is executing then compiler will ignore the commented lines
two types
1. Single line: //
2. Multi line: /*….*/
10. Main method is the starting point of the execution point of the program.
Data types in java:
Which means how exactly you are representing your data.
1. Int: declaring with “int” keyword.
ex: int i=10; when ever we write this line, in memory some space or locatin will be given to
variable i.
I can’t create duplicate variable by using “int” keyword. If I want to change the value of variable
then we can directly assign that value to variable: i=20;
I can create n number of variables.
Each statement should be ended with semicolon ‘;’.
2. Double: we can declare decimal value using double key word. We can store integer values in
double.
3. Char: we can declare characters like “a”, “n” by using ‘char’ keyword. It should be declared by
using single quote: ‘k’. character should be single digit value it shouldn’t be more than one
character.
4. Boolean: means true or false. True or false also key words in java.
5. String: string in java is not a data type, it’s class in java but yes we can use as data type. It should
be declared as follows:
String s =”test”; //why capital ‘S’ means it is a class in java. And specified in double quotes.
Multiple words are allowed in String.
Primitive data types: integer, double, char, Boolean are called primitive data types.
Syso—ctrl+space, short cut for the system.out.println();
We can print variable after declaration only not before the declaration.
Systeom.out.println(): is used to print the output in new line.
System.out.print(): is used to print on the same line
String Concatenation: ‘+’ is concatenation operator.
Always execution from left to right side.
If else statements or comparison operators:
If(b>a) inside the if we always write the Boolean condition i.e., true or false.
‘=’ means we are assigning the value to a variable.
‘==’ means to compare the value.