I can't understand the keywords in java?

Here two things I want to know I really don’t get them so please if you can explain me as simple as possible (also in simple english)

The terms are -

  1. What is object oriented and functional programming ?
  2. What is a Class in (OOP) ?
  3. Can anyone fully explain me the syntax of Java hello world ( from public class to public static )

Right here {

public class Main {
public static void main(String[] args) {
System.out.println(“Hello world!”);


Hey, I think I can help you out. Here are my best answers:

1.) Object-oriented programming is a style of programming in which most or all of your code is contained inside of classes (Java is entirely object-oriented), meaning that functions and variables are created in classes and accessed through objects rather than just created and accessed openly (as usually in Python and Javascript, though you can use classes and objects in those languages as well). Functional programming is simply a style of programming in which all variables are immutable (do not change) and the code always returns the same result given the same input. functional programming and Object-oriented programming are not mutually exclusive, but it’s rare to see a functional program use classes and object (in my experience).

2.) A class is simply a blueprint for creating an object. When you create a class with some variables and functions and then create objects from that class, those objects all possess those variables and functions you defined in the class. In short, a class is simply a way to contain your code, making it accessible only through objects rather than all out in the open (possibly making a hard to manage mess).

3.) Here is how you can print out “Hello World” to the console (with some comments):

public class Main {
//class can be called something else and can simply be whatever class you are working in.

     public static void main(String args[]) {
     //this is the main method, what actually creates the connection to our console. Don't worry about the syntax too much, what's important to take away is that this is a method (function) that outputs a string to the console.

     system.out.println("Hello World");
    //here is the command to print out a variable, in this case, the string "Hello World".


Thanks So can we say that a class is just a folder that contains are code ?

More or less. Though classes may or may not be contained in separate files from your main code.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.