为我做功课 [英] Do my homework for me

查看:76
本文介绍了为我做功课的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Q1

什么可以直接访问和更改变量roomNr的值?

Q1
What can directly access and change the value of the variable roomNr?

package com.mycompany;
 
public class Hotel {
public int roomNr = 100;
}





A)只有酒店级。

B)任何课程。

C)com.mycompany包中的任何类。

D)任何扩展酒店的类。

_____



Q2

鉴于:

d是一个有效的非空java.util .Date对象

df是一个有效的,非null的java.text.DateFormat对象,设置为当前语言环境。

输出当前语言环境的国家名称和适当的日期版本?

A)



A) Only the Hotel class.
B) Any class.
C) Any class in com.mycompany package.
D) Any class that extends Hotel.
_____

Q2
Given:
d is a valid, non-null java.util.Date object
df is a valid, non-null java.text.DateFormat object set to the current locale.
What outputs the current locale''s country name and the appropriate version of date?
A)

Locale l = Locale.getDefault();
System.out.println(l.getDisplayCountry() + " " + df.format(d));



B)


B)

Locale l = Locale.getLocale();
System.out.println(l.getDisplayCountry());



C)


C)

Locale l = Locale.getLocale();
System.out.println(l.getDisplayCountry() + " " + df.setDateFormat(d));



D)


D)

Locale l = Locale.getDefault();
System.out.println(l.getDisplayCountry() + " " + df.setDateFormat(d));



_____



Q3

a,b,aa在标有// some code goes here的行引用的对象的真实情况是什么?


_____

Q3
What is true about objects referenced by a, b, aa at the line labeled "// some code goes here"?

class A {
    private B b;
    public A() {
        this.b = new B(this);
    }
}

class B {
    private A a;
    public B(A a) {
        this.a = a;
    }
}

public class Test { 
    public static void main(String args[]) {
        A aa = new A();
        aa = null;
        // some code goes here
    }
}



A)a和b引用的对象有资格进行垃圾回收。

B)这些对象都不符合垃圾回收的条件。 />
C)只有a引用的对象才有资格进行垃圾回收。

D)只有b引用的对象才有资格进行垃圾回收。

E)只有aa引用的对象才有资格进行垃圾回收。

_____



Q4

您需要做些什么来纠正编译错误? (选择两项)


A) The objects referenced by a and b are eligible for garbage collection.
B) None of these objects are eligible for garbage collection.
C) Only the object referenced by "a" is eligible for garbage collection.
D) Only the object referenced by "b" is eligible for garbage collection.
E) Only the object referenced by "aa" is eligible for garbage collection.
_____

Q4
What do you need to do to correct compilation errors? (Select two)

public class Creature {
private int legCount;
private int wingCount;

public Creature(int legCount) {
this.legCount = this.legCount;
this.wingCount = 0;
}

public String toString() {
return "legs=" + this.legCount + " wings=" + wingCount;
}
}

public class Animal extends Creature {
public Animal(int legCount) {
this.wingCount = 0;
}

}



A)在生物构造函数中插入对super()的调用。

B)将一个对super()的调用插入到Animal构造函数中。

C)将一个对this()的调用插入到Animal构造函数中。

D)插入对super的调用( legCount)到Animal构造函数。

E)将类Creature中的wingCount变量更改为protected。

F)在类中更改字符串this.wingCount = 0动物到super.wingCount = 0


A) insert a call to super() into Creature constructor.
B) insert a call to super() into Animal constructor.
C) insert a call to this() into Animal constructor.
D) insert a call to super(legCount) into Animal constructor.
E) change the wingCount variable in the class Creature to protected.
F) change the string "this.wingCount = 0" in the class Animal to "super.wingCount = 0"

推荐答案

我们不做你的作业:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是像你想的那么难!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!


嗯...是的。

简单的东西,



Q1:b)

Q2:a)



Aaah,我刚看到Nagys POP评论。

否我不做你的作业。
Uhm... Yeah.
Easy stuff,

Q1: b)
Q2: a)

Aaah, I just seen Nagys POP comment.
No. I don''t do your homework.


这篇关于为我做功课的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆