Java Basic Programming Elements

That's_rushi
Mar 4, 2023

--

  1. Package:

Packages are group of classes which is used to avoid naming conflicts of same class name. Inside package we need to write our classes.

It is a java folder used to group classes, interfaces and enums.

Ex: package com.software;

public class FirstProgram {

public static void main(String[] args) {

int x=10;

int y=20;

//System.out.println(“Adding x and y”);

System.out.println(x+y);

}

}

2) Class:

3) Interface: All these three are java files used to group java data and logic. 4) Enum:

5) Variable: It’s a named memory location used to store java data.

6) Method: It’s a sub block of a class used to implement logic of an object operations.

--

--

That's_rushi

Developer with experience in application development using Java, spring boot and J2EE. Expertise in using Core Java & Web technologies like Restful Webservices.