I personally believe that the basis for learning a programming language is to learn from demos.
Practice the console output tool. System.out.println outputs newlines, and System.out.print outputs no newlines.
package com;
public class Test {
public static void main(String[] args) {
System.out.println("hello, Tang Huimin.");
System.out.println(args[0]);
System.out.println(args[1]);
}
}
Configuration parameter args:
Run result:
package com;
public class Test {
public static void main(String[] args ) {
System.out.print("hello, Tang Huimin.");
System.out.print(args[0]);
System.out.print(args[1]);
}
}
Run result:
Output a triangle composed of "*"
package com;
public class Test {
public static void main(String[] args) {
System.out.println(" *");
System.out.println(" ***");
System.out.println("*****");
System.out.println("*****");
}
}
Run result:
Output symbol expression
package com;
public class Test {
public static void main(String[] args ) {
System.out.println(" ╭︿︿︿╮ ");
System.out.println(" {/ o o /}");
System.out.println(" ( (oo) )");
System.out.println(" ︶ ︶︶");
}
}
Result:
The above is the detailed content of Java language overview. For more information, please follow other related articles on the PHP Chinese website!