01.What is a package?
It's nothing but a folder.
It is used to maintain code in a folder structure.
02.How to create the Package folder?
Open the Eclipe IDE
Then, click the "File option" select the "Package" option.
Write the Package name, The package name's first letter should be lowercase.
create the package folder.
- What is Class? Class is a blueprint or template. Class contains properties & functions. Class is a logical entity Class is a Java keyword.
04.why class is used to the java?
Represent Real-World Things.
Java uses classes to model real-world entities like:
Student, Employee, Bank Account, Car, etc.
Each class contains data and behavior related to that entity.
Syntax of class:
public Class name (Ex, Parent, Life, School)
{
}
The class name's first letter should be capitalized (uppercase).
Class name should allow these special characters like $ and -.
Class name should allow numeric number in the middle and last.
When combining 2 words (camel case) to form a class name, the first letter of the 2nd word must be capitalized.
Note: If main method not available in the class method ,then not run or execute the java program.
Class and main method coding:
package hello;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello Youtube");
}
}
Main method:
write the "main" at the same time click the "ctrl+ space".
System out:
Write the "syso" At the same time click the "ctrl+ space".
; is a end of the sentence.
- What is an Object? *An object is a physical entity or real-world entity. *It is a real-world entity created based on the blueprint provided by the class.
06.why object used in the java?
Heap memory inside of the RAM memory
Syntax object:
ClassName referenceName = new ClassName();
EX: SuperMarket vegetables = new SuperMarket();
Reference name should be first letter is lowercase.
= is a assignment operator.
An object is a combination of state and behavior.
new is a Java keyword.
07.Characteristics of an Object:
State → stored in fields (variables) or properties
Behavior → defined by methods (functions)
08.What is the Functional or Methods:
1.Methods are used to perform certain action, and they are also knows as functions.
- Mostly used to perform any of the repetitive tasks.
Access modifier:
public
private
protected
default/package
syntax:
access Modifier return Type method Name()
{
}
EX:
public void createVideo(){
}
Top comments (0)