题目内容 (请给出正确答案)
[主观题]

import java.io.*; public class abc { public static void main(String args [ ]) { AB s = new

1、 import java.io.*; public class abc { public static void main(String args [ ]) { AB s = new AB("Hello!","I love VA"); System.out.println(s.toString(); } } class AB { String s1; String s2; public AB(String str1, String str2) {sl = str1; s2 = str2;} public String toString() { return s1+s2; }

查看答案
如搜索结果不匹配,请 联系老师 获取答案
您可能会需要:
您的账号:,可能会需要:
您的账号:
发送账号密码至手机
发送
更多“import java.io.*; public class…”相关的问题

第1题

import java.io.*;

public class abc

{

public static void main(String args[ ])

{

AB s = new AB("Hello!","I love JAVA.");

System.out.println(s.toString( ));

}

}

class AB

{

String s1;

String s2;

AB (String str1 , String str2 )

{

s1 = str1;

s2 = str2;

}

public String toString( ) { return s1+s2;

}

}

点击查看答案

第2题

public class Test{ public static void main(String args[]){ int a=2,b=4,c=6 Strint s="abc"; System.out.print (a/b+s+c); } }

A.absac

B.242466

C.6abc6

D.24abc6

点击查看答案

第3题

设有程序如下: abstract class absclass { abstract void method1(); } class conclass extends absclass { public void method1() { System.out.println("子类");} } public class mainclass { public static void main(String args[]) { absclass ac1=new absclass(); //语句1 absclass ac2=new conclass(); //语句2 ac2.method1(); //语句3 } } 则main()方法中的第三条语句(即语句3)中的method1()是指conclass中定义的method1方法。()

此题为判断题(对,错)。

点击查看答案

第4题

Whatwillbewrittentothestandardoutputwhenthefollowingprogramisrun?()publicclassQ8499{publicstaticvoidmain(Stringargs[]){doubled=-2.9;inti=(int)d;i*=(int)Math.ceil(d);i*=(int)Math.abs(d);System.out.println(i);}}

A.12

B.18

C.8

D.9

E.27

点击查看答案

第5题

请完成下列Java程序。程序的功能是利用迭代法求一个数的平方根(求平方根的迭代公式为:Xn+1=1/2(Xn+a/Xn)).

注意:请勿改动main()主方法和其他已有的语句内容,仅在下划线处填入适当的语句。

public class PingFangGen{

public static void main(String args[]){

System. out. println(Math, sqrt(2.0));

}

static double sqrt(______){

double x=1.0

do

{

_______

}

while( Math. abs(x*x-a)/a>le-6)

return x;

}

}

点击查看答案

第6题

下列程序段中,正确的是______。 ①class MvClass { int var = 100; static int getVar() { return var; } } ②public class MyClass { final int date; void MyClass (int d) { date = d; } } ③public class MyMain { public static void main(String args[]) { System.out.println(Myclass1.date); } } class MyClass1 { int data = 10; } ④class IamAbstract { final int f; double d; abstrct void method(); }

A.②④

B.①③

C.②

D.以上都不对

点击查看答案

第7题

程序填空: 下列程序定义了Car汽车类和BMW宝马车子类,...

程序填空: 下列程序定义了Car汽车类和BMW宝马车子类,补充相应的语句,使整个程序完整并能够正常运行。 程序运行结果: 品牌:宝马;型号:X5 启动 源代码如下: //BMW.java 【 1 】class Car { private String bland; private String type; public abstract void start(); public 【 2 】(String bland, String type) { this.bland = bland; this.type = type; } public String toString() { return "品牌:" + bland + ";型号:" + type; } } public class BMW 【 3 】Car { public BMW(String bland, String type) { 【 4 】(bland, type); } public void start() { System.out.println("启动"); } public static void main(String args[]) { Car car = new 【 5 】("宝马", "X5"); System.out.println(car.toString()); car.start(); } } 空【1】填入内容为:

A、public

B、abstracct

C、private

D、static

点击查看答案

第8题

下列哪个类声明是正确的? ( )

A.abstract class G2 extends superClass1,superClass2{...}

B.abstract public class classmates{...}

C.public final class NewClass extends superClass implemnets Interface1{...}

D.public abstract class String{...}

点击查看答案

第9题

【C++代码】

#include

#include

#include

using namespace std;

class AbstractFile{

protected:

string name; //文件或目录名称

public:

void printName(){cout$amp; virtual void addChild(AbstractFile *file)=0; //给一个目录增加子目录或文件}

virtual void removeChild(AbstractFile *file)=0; //删除一个目录的子目录或文件

virtual list *getChildren()=0; //获得一个目录的子目录或文件

};

class File:public AbstractFile{

public:

File(string name) {(1) = name;}

void addChild(AbstractFile *file){return;}

void removeChild(AbstractFile *file){return;}

(2) getChildren(){return (3) ;}

};

class Folder :public AbstractFile{

private:

list childList: //存储子目录或文件

public:

Folder(string name){ (4) name;}

void addChild(AbstractFile*file){childList.push_back(file);}

void removeChild(AbstractFile*file){childList.remove(file);}

list*getChildren(){return (5) ;}

};

void main(){

//构造一个树形的文件/目录结构

AbstractFile *rootFolder=new Folder("c:\\ ");

AbstractFile*compositeFolder=new Folder("composite");

AbstractFile *windowsFolder=new Folder("windows");

AbstractFile*file=new File("TestCompositejava");

rootFolder->addChild(compositeFolder);

rootFolder->addChild(windowsFolder);

compositeFolder->addChild(file);

点击查看答案

第10题

写出制备下列高分子材料的单体名称.|1、锦纶6|2、PIP|3、芳纶1313|4、ABS
点击查看答案
热门考试 全部 >
相关试卷 全部 >
账号:
你好,尊敬的上学吧用户
发送账号至手机
密码将被重置
获取验证码
发送
温馨提示
该问题答案仅针对搜题卡用户开放,请点击购买搜题卡。
马上购买搜题卡
我已购买搜题卡, 登录账号 继续查看答案
重置密码
确认修改
谢谢您的反馈

您认为本题答案有误,我们将认真、仔细核查,
如果您知道正确答案,欢迎您来纠错

警告:系统检测到您的账号存在安全风险

为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!

微信搜一搜
上学吧
点击打开微信
警告:系统检测到您的账号存在安全风险
抱歉,您的账号因涉嫌违反上学吧购买须知被冻结。您可在“上学吧”微信公众号中的“官网服务”-“账号解封申请”申请解封,或联系客服
微信搜一搜
上学吧
点击打开微信