eclipse里设置运行参数

来源:互联网 发布:淘宝众筹靠谱吗 编辑:程序博客网 时间:2024/06/07 03:25

为了运行带assert的程序

import java.util.*;import java.util.Scanner;public class AssertionExample {public static void main(String args[]) {Scanner scanner = new Scanner(System.in);System.out.print("Enter a number between 0 and 20: ");int value = scanner.nextInt();assert (value >= 0 && value <= 20) : "Invalid number: " + value;System.out.printf("You have entered %d\n", value);}}



原创粉丝点击