(5) is correct because sleep() will always pause the currently running thread for at least the duration specified in the sleep argument (unless an interrupted exception is thrown).
(6) is correct because, assuming that the thread you're calling join() on is alive, the thread calling join() will immediately block until the thread you're calling join() on is no longer alive.
(1) is wrong, but tempting. The yield() method is not guaranteed to cause a thread to leave the running state, although if there are runnable threads of the same priority as the currently running thread, then the current thread will probably leave the running state.
(3) and (4) are incorrect because they don't cause the thread invoking them to leave the running state.
(7) is wrong because there's no such method.
class X implements Runnable { public static void main(String args[]) { /* Missing code? */ } public void run() {} }
(3), (5), (7), and (8) are incorrect answers. The methods isInterrupted() and interrupt() are instance methods of Thread.
The methods sleep() and yield() are static methods of Thread.
D is incorrect because synchronized is a keyword and the synchronized() construct is part of the Java language.
Option B is incorrect because any literal number with a decimal point u declare the computer will implicitly cast to double unless you include "F or f"
Option C is incorrect because it is a String.
Option D is incorrect because "d" tells the computer it is a double so therefore you are trying to put a double value into a float variable i.e there might be a loss of precision.
(3) - This is a Java keyword
(1) - Is incorrect because although it is a method of Thread/Runnable it is not a keyword
(4) - This is not a Java keyword the keyword is implements
(3), (4), and (5) are not legal Thread constructors, although (4) is close. If you reverse the arguments in (4), you'd have a valid constructor.
(2) and (3) are incorrect because they are methods of the Object class. (5) is incorrect because there's no such method in any thread-related class.
Option A is wrong. The run() method of a thread is like the main() method to an application. Starting the thread causes the object's run method to be called in that separately executing thread.
Option B is wrong. There is no construct() method in the Thread class.
Option D is wrong. There is no register() method in the Thread class.
Option A and D are incorrect because they are narrowing the access privileges i.e. package(default) access is narrower than public access.
Option C is not method in the Runnable interface therefore it is incorrect.
Comments
Copyright CuriousTab. All rights reserved.
Kampfer Strong kid wall New.Ярмарка вакансий - ежегодное мероприятие, организатором которого выступает ведущее англоязычное издание в Украине Kyiv Post. Данное мероприятие проводится уже более 15 лет и собирает на одной площадке ведущих работодателей страны и талантливую молодежь.Покупая детские игровые, спортивные комплексы производства компании «KinderLand»,способных прослужить долгие годы, Вы убедитесь в профессионализме наших конструкторов, инженеров, дизайнеров. Наша команда, будучи мамами и папами, понимает потребности своих маленьких клиентов и беспокоится об их безопасности, комфорте.Купить Большие садовые фигуры от производителя.Первое время осваивать спортивный комплекс для малышей можно только под присмотром родителей. Взрослые должны учить своё чадо правильно залазить и слазить, падать и спрыгивать. Соблюдая и зная технику безопасности, юный спортсмен будет защищён от синяков, ссадин и шишек. Зато результат и польза от таких занятий не заставят себя ждать: малыш будет расти крепким и гибким, полноценно начнут развиваться мышцы, окрепнут костная система и позвоночник, повысятся координация и моторика. Регулярная ходьба по перекладинам босыми ногами будет профилактикой для предотвращения развития плоскостопия.Материал спортивного комплекса : Каркас — бук. Перекладины — бук.