java questions , help me and answer them please ! 6. Which of the following clas
ID: 3773252 • Letter: J
Question
java questions , help me and answer them please ! 6. Which of the following classes define a legal abstract class? 1: class A 2: abstract void unfinished 4: 1: public class abstract A 2: abstract void unfinished 1: class A 2: abstract void unfinished 3: 1: abstract class A 2: protected void unfinished 3: 1: abstract class A 2: abstract void unfinished 3: 1: class A 2: abstract int unfinished 3: 7. Suppose A is an interface. Can you create an instance using "new A() 8. Which of the following (if any) is a correct interface? (Assume I1 and 12 are correctly defined elsewhere.) 1: interface A 2: void print 3: 4: 1: abstract interface A extends I1, 12 2: abstract void print 3: 4: 1: abstract interface A print 1: interface A 2: void print 3:Explanation / Answer
6. The following classes define a legal abstract class
public class abstract A
{
abstract void unfinished()
{
}
}
abstract class A
{
protected void unfinished();
}
abstract class A
{
abstract void unfinished();
}
7. Yes. We Can Create Instance Like this
interface A
{
void print();
}
public class myclass
{
public static void main(String args[])
{
A obj=new A() {
public void print()
{
throw new UnsupportedOperationException("Not supported yet.");
}
};
}
8. The following is a correct interface
interface A
{
void print();
}
Abstract Interfaces:
Every interface is implicitly abstract. This modifier is obsolete and should not be used in new programs.
Abstract Method Declarations:
For compatibility with older versions of the Java platform, it is permitted but discouraged, as a matter of style, to redundantly specify the abstract modifier for methods declared in interfaces.
9.
a) A layout manager is an object that implements the LayoutManager interface* and determines the size and position of the components within a container. Although components can provide size and alignment hints, a container's layout manager has the final say on the size and position of the components within the container.
b) JFrame's default Layout Manager is BorderLayout.
10.
public class reverse extends JFrame
{
public reverse()
{
add(new Button("OK"));
}
public static void main(String args[])
{
JFrame frame = new JFrame();
frame.setSize(100,200);
frame.setVisible(true);
}
Correct Method is
public class reverse extends JFrame
{
public reverse()
{
add(new Button("OK"));
}
public static void main(String args[])
{
Test frame = new Test();
frame.setSize(100,200);
frame.setVisible(true);
}
The problem is you are calling new JFrame instead call the class that extends JFrame
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.