Any hardware or software environment in which a program runs, is known as a platform. Java has a runtime environment (JRE) and API, So it is also called as platform.
‘is a’ relationship is also known as inheritance. We can implement ‘is a’ relationship or inheritance in java
using extends keyword. The advantage or inheritance or is a relationship is re-usability of code instead of
duplicating the code.
Example : Motor cycle is a vehicle
Car is a vehicle Both car
- Variable names should start with small letters.
- Variable names should be nouns.
- Short meaningful names are recommended.
- If there are multiple words every inner word should start with Uppercase character.
Example : string, value, empName, empSalary
- Interface should start with uppercase letters
- Interfaces names should be adjectives
Example : Runnable, Serializable, Marker, Cloneable
>> is a right shift operator shifts all of the bits in a value to the right to a specified number of times.
int a =15;
a= a >> 3;
The above line of code moves 15 three characters right.
>>> is an unsigned shift operator used to shift right. The
Multi-threading is a Java feature that allows concurrent execution of two or more parts of a program. Each part of such program is called a thread. So, threads are light-weight processes within a process.
Threads can be created by using two mechanisms :
- Extending the Thread class
- Implementing the Runnable Interface
Thread creation by
Constants in java are created using static and final keywords.
- Constants contains only uppercase letters.
- If constant name is combination of two words it should be separated by underscore.
- Constant names are usually nouns.
Example : MAX_VALUE, MIN_VALUE, MAX_PRIORITY, MIN_PRIORITY
- Method names should start with small letters.
- Method names are usually verbs
- If method contains multiple words, every inner word should start with uppercase letter.
- Method name must be combination of verb and noun
Example : toString(), getCarName(), getCarNumber()
Sun has created Java Coding standards or Java Coding Conventions . It is recommended highly to follow java coding standards. Class names should start with uppercase letter. Class names should be nouns. If Class name is of multiple words then the first letter of inner word must be capital letter.
Constants are fixed values whose values cannot be changed during the execution of program. We create constants in java using final keyword.
final int number = 10;
final String str=”java-constants”;