๐ฏ๐ฏ DAY 3- INTRODUCTION TO JAVA (II) ๐ฏ๐ฏ
Yho Codestars! It's day 3 and I still feel quite energetic๐ถ . So here is what I learned today, feel free to comment and follow my blog๐ .
Today's JAVA lesson!
The basic element of Java:
Java has 3 basic elements; Class, Interface, and Enum.
We can only write a java program with the aid of these 3 elements, without class and interface, there is no Java program.
Syntax of the basic elements:
Syntax is a set of rules we need to follow when writing a program.
- Class
- Interface
- Enum
Access modifiers provide access restrictions to a class. There are 4 types of access modifiers;
Public
Private
protected
Default
We cannot declare a Java class as private, or protected, the same goes for interface and enum.
Examples of the basic element's syntax:
- The example in the first row shows the public class and the second row shows the default class.
- The word; public, class, static, and void are JAVA Keywords.
- //variables, //methods, //blocks can all be written in a class
There are 50 Keywords in JAVA. All the keywords start with small letters and Java is case sensitive. Every Java program starts with the main method and ends with the main method.
*Without the main method you cannot execute a program*
Data types show the various sizes and values that can be stored in a variable.
Comments
Post a Comment