Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with this please. Thank you. 11. A date or time conversion code with

ID: 3716204 • Letter: I

Question

I need help with this please. Thank you.

11. A date or time conversion code within a format specifier is prefixed with a(n) 12. To call a static method from outside the class where it is defined, the method name must be prefixed with a(n) 13. A recursive method handles both and cases is the preferred method for creating threads in an application 15. Method explicitly calls the constructor of the parent class. a static method in the 16. A static method in a child class parent class with the same signature. is the top of the Java class hierarchy. 17. Class to connect a method call in Polymorphism in Java uses the parent class to the corresponding method in a child class. 18.

Explanation / Answer

11. 't' or 'T'

Explanation: When writing a print statement for date or time conversion code within a format specifier, we write the character 't' or 'T' before the suffix character which is desired for specific time or date format. e.g.

import java.util.*;

public class Temp{

Date date = Calendar.getInstance().getTime();

System.out.printf("%tc", date);

System.out.printf(" %Tc", date);

}}

whose output will be:

12. public

Explanation: when we define a static method in a class, we provide it with public access specifier to acces it from other class. e,g,

class Temp1{

public static void fun(){

System.out.println("Hello");

}

}

class Temp2{

public static void main(String[] args){

Temp1 obj = new Temp1();

obj.fun();

}

}

13. finite and infinite

Explanation: recursion is a tool used to convert loops to methods calling themselves which leads to infinte problems seeming as finite subproblems and calling itself. This also solves the problem of infinite loops.

14. start()

Explanation: threads are created by extending Thread class to your main class and defining the actual working of the thread in run method. But to actually run a thread, the object of Thread class is required to call start() method.

e.g.

class TempThread extends Thread {

public void run(){

// Execution of statements in the thread

}

public static void main(String [] args){

Thread t1 = new TempThread();

Thread t2 = new TempThread();

t1.start(); // calls run() method

t2.start(); // calls run() method

}

}

15. super()

e.g.

class A{

A(){

//construct of A defintion

}

}

class B extends A{

B(){

super() // calls constructor of A

// constructor definition of B

}

}

16. cannot override

Explanation: because static method is a class method which can be called by class name directly also from the reference variable(or object of class). During run time of the program, the definition of static method in parent class will be called, no overriding of method will be done.

17. Object class

Parent class of all classes in java

18. vitual method invocation

e.g.

class A{

public void fun1(){

// fun1 definition

}

}

class B extends A{

public void fun1(){

// fun1 definition

}

}

class Temp{

public static void main(String [] args){

B obj1 = new B();

A obj2 = new B(); // object creation with child class

obj1.fun1() // method from B class with be executed

obj2.fun1() // at the time of compilation, method from A class is checked but at run time, the method from B class is //executed

}

}