what java code example
Example 1: what is java
public class Main {
public static void main(String[] args) {
System.out.println("Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a general-purpose programming language intended to let application developers write once, run anywhere (WORA),[17] meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.[18] Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar to C and C++, but has fewer low-level facilities than either of them. The Java runtime provides dynamic capabilities (such as reflection and runtime code modification) that are typically not available in traditional compiled languages. As of 2019, Java was one of the most popular programming languages in use according to GitHub,[19][20] particularly for client-server web applications, with a reported 9 million developers.[21]");
}
}
/* run this program in online compiler
and u will find the answer */
Example 2: what is java
Q: What is Java?
A: Java is a class-based, object-oriented programming language that is
designed to have as few implementation dependencies as possible.
Example 3: what is java
class farmers
{
String crops="Wheat";
void grows();
{
System.out.println(“Farmers grows Wheat”);
}
}
public class Animals extends farmers
{
void eat();
{
System.out.println(“Animals eat Wheat”);
}
public static void main (String args[])
{
Animals obj=new Animals();
System.out.println(obj.crops);
obj.grows();
obj.eat();
}
}