Home >Java >javaTutorial >Java is a stable language with a long history and strong community support.
Java is a stable and mature programming language that is loved by developers. With a long history and strong community support, Java excels in enterprise-level application development and cross-platform applications. PHP editor Zimo will introduce you to the advantages and features of Java in detail, allowing you to have a deeper understanding of this powerful programming language.
public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, world!"); } }
This code is a simple Java program that outputs "Hello, world!" to the console.
import java.util.Scanner; public class InputExample { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter your name:"); String name = scanner.nextLine(); System.out.println("Hello, " + name + "!"); } }
This code is a simple Java program that reads the name entered by the user and outputs "Hello, [name]!" to the console.
import java.util.ArrayList; public class ArrayListExample { public static void main(String[] args) { ArrayList<String> names = new ArrayList<>(); names.add("John"); names.add("Mary"); names.add("Bob"); for (String name : names) { System.out.println(name); } } }
This code is a simple Java program that uses an ArrayList to store a set of names and output each name to the console.
The above is the detailed content of Java is a stable language with a long history and strong community support.. For more information, please follow other related articles on the PHP Chinese website!