Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#Java Course

##Java basic

### DATA TYPES

There are 8 primitive data types in java :-

1- Byte --> byte (numeric value)

2- Short --> short (numeric value)

3- Char --> char (can be used as for numeric value only character)

4- int --> integer (numeric value)

5- long --> Long (numeric value)

6- float --> Float(numeric value eg : 9.87f)

7- double --> Double(numeric value)

8- boolean --> Boolean ( true and false)

ranges are provided in code of all primitive data types .

## Reference types in Java:-
1. class types − This reference type points to an object of a class.

2. array types − This reference type points to an array.

3. interface types − This reference type points to an object of a
class which implements an interface.

**The main difference between primitive and reference type is that primitive type always has a value, it can never be null but
reference type can be null, which denotes the absence of value.

##In Java there are four types of references differentiated on the way by which they are garbage collected.
Strong References.

Weak References.

Soft References.

Phantom References.


## NAMING CONVENTIONS IN JAVA
1: camelCase ( it can be a fields / methods / packages )
eg: bankAccountNumber

2: PascalCase ( class name)
eg: MobileShop

## Scope of a variable

region

it is a part of an program/software where the variable is defined to be accessible .

on the basis of where it is defined :
- local to a method
- as a parameter to the method.
- class variable ( static / class owned )
- in a different class
- local to method

- as a parameter

- class variable


## Types of Fields in class ( on the basis of ownership)

1. class variable ( static / class owned )
2. instance variable ( non-static / object owned )


## Accessibility modifiers

1. Private
2. Public
3. Protected
4. Default
5 changes: 4 additions & 1 deletion src/takingInput/UsingScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ public class UsingScanner {
*/
public static void main(String[] args) {
System.out.println("Enter your name: ");
// for single input we can use this .
// java.util.Scanner scannerObject = new java.util.Scanner(System.in);
Scanner scannerObject = new Scanner(System.in);
// for taking multiple input using one object e.i scannerObject .
String inputName = scannerObject.nextLine();

// int number = scannerObject.nextInt();
System.out.println("The name is: " + inputName);
}
}