C+++++++++++++++++++++++++++ JAVA

#include <iostream>

// Define a class named MyClass
class MyClass {
public:
    // Declare a public member function named myFunction
    void myFunction() {
        // Print a message to the console
        std::cout << "Hello from C++!" << std::endl;
    }
};

// Define the main function
int main() {
    // Create an instance of the MyClass class
    MyClass myObject;

    // Call the myFunction method of the MyClass instance
    myObject.myFunction();

    // Return 0 to indicate successful program execution
    return 0;
}
// Declare a public class named MyClass
public class MyClass {
    // Define the main method, the entry point of the Java program
    public static void main(String[] args) {
        // Print a message to the console
        System.out.println("Hello from Java!");
    }
}