๐ŸŽฏ๐ŸŽฏ 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
<Acess modifier> class <class name>
{

}

  • Interface
<Acess modifier> interface < interface name>
{

}

  • Enum
<Acess modifier> enum < enum name>
{

}


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.




































๐Ÿ‘ฉ‍❤️‍๐Ÿ’‹‍๐Ÿ‘จ  I hope you had fun learning Java with me? ๐Ÿคฉ  Feel free to drop a comment and contribute. โ„‹โ„‹ 






Comments

Popular posts from this blog

๐Ÿ’…๐Ÿ’…MY ACRONYMS- EXTRA NOTES (Series I)๐Ÿ’…๐Ÿ’…

๐Ÿ˜ฎ๐Ÿ˜ฎ DAY 4- FEATURES OF JAVA ๐Ÿ˜ฎ๐Ÿ˜ฎ

♕♕♕My First Blog Post♕♕♕

๐ŸŽฏ๐ŸŽฏDAY 1- INTRODUCTION TO JAVA๐ŸŽฏ๐ŸŽฏ