题目详情
多选题 分析以下代码:public class Test { public static void main(String[] args) { A a = new A(); a.print(); }}class A { String s; A(String s) { this.s = s; } void print() { System.out.println(s); }}
A. 程序有编译错误,因为类a不是公共类
B. 程序有编译错误,因为类a没有默认构造函数
C. 该程序编译运行良好,没有打印任何内容
D. 如果将A a = new A()更改为A a = new A("5"),程序将编译并运行

学科:Java程序设计
时间:2025-03-14 05:58:34
相关题目
相关作业
