public class helloworld { public static void main(string[] args) { system.out.println("hello world!"); } } 首先编译,进入E盘,输入“e:”然后enter 接着输入 Javac helloworld.java 就是这个5行的小程序,出现了3个错误 1:错误:类helloworld是公共的,应在名为 helloworld.java 的文件中声明 public class hellow
1. 利用循环打印如下图形 ***** **** *** ** * public class Main { public static void main(String[] args) { // TODO Auto-generated method stub int i = 5; while (i >= 0) { for (int j = i; j > 0; j--) System.out.print("*"); System.out.println(); i--; } }
判断闰年. package com.test; import java.util.Scanner; import org.junit.Test; public class TestRunNian { @Test public void test1() { Scanner scanner = new Scanner(System.in); while (true) { int year = scanner.nextInt(); if (year == -1) { System.out.printl
编写一个程序,此程序在运行时要求用户输入一个 整数,代表某门课的考试成绩,程序接着给出“不及格”.“及格”.“中”.“良”.“优”的结论. 要求程序必须具备足够的健壮性,不管用户输入什 么样的内容,都不会崩溃. //信1605-3程浩20163667 import java.util.Scanner; public class Demo { public static void main(String[]args) { Scanner sc=new Scanner(System.in); int