A Java program can be thought of as a collection of a series of objects that work together by invoking each other's methods.
Object: An object is an instance of a class that has state and behavior.
A dog is an object. Status: Color, name, variety, behavior: wagging the tail, barking, eating.
Class: Is a template that describes the behavior and state of a class of objects
Method: The method is the behavior, a class can have many methods. Logical operations, data modifications, and all actions are done in the method.
Instance variables: Each object has a unique instance variable, and the state of the object is determined by the value of these instance variables.
Print String Helloalbert
public class Helloalbert
{
/* First Java program
* It will print the string Helloalbert
*/
public static void Main (String [] args) {
System.out.println ("Helloalbert");//Print Helloalbert
}
}
Error occurred:
Solution: Javac Helloalbert.java
Java Helloalbert
First day of Java Foundation