What is wrong in the following code? class TempClass { int i; public void TempClass(int j) { int i = j; } } public class C { public static void main(String[] args) { TempClass temp = new TempClass(2); } }

发布于 2021-02-15 03:24:46
【单选题】
A The program has a compilation error because TempClass does not have a default constructor
B The program has a compilation error because TempClass does not have a constructor with an int argument
C The program compiles fine, but it does not run because class C is not public
D The program compiles and runs fine

查看更多

关注者
0
被浏览
102
  • 体验AI问答!更聪明、超智能!
  • 一款基于GPT的超级AI助手,可以对话、创作、写文案!
青云
青云 2023-02-15
生命之长短殊不重要,只要你活得快乐,在有生之年做些有意义的事,便已足够。
1 个回答

撰写答案

请登录后再发布答案,点击登录

发布
问题

手机
浏览

扫码手机浏览

分享
好友

在线
客服