Help me!!!
Publicado por Mariela (1 intervención) el 28/06/2008 19:22:30
holass necesito ayuda con unos ejercicios de java: lo necesito pa hoy si pueden decir la rpta de cada uno y el porque de que es esa rpta xfissssssssssss
15. What is the most restrictive access modifier that can be applied to a member if that member must be accessible to members of a subclass within the same package as the superclass?
public
private
abstract
protected
default access
16. Which can be overridden? (Choose one.)
native void methoda();
final void methoda() {}
void final methoda() {}
synchronized final void methoda() {}
17. Which declaration ensures that a class cannot be subclassed?
abstract class MyClass { }
final public class MyClass { }
final abstract class MyClass { }
static private class MyClass { }
static protected class MyClass { }
18. Which is true about the default constructors? (Choose one.)
The default constructor is always public
The default always invokes the no-arg superclass constructor
The default constructor inherits the arguments of the superclass constructor
The compiler creates a default constructor if the class does not have a no-arg constructor defined
19. Which modifier limits access to a method of a public class to members of the same class?
final
public
private
protected
default access
20. Which of the following class level (nonlocal) variable declarations will not compile?
protected int a;
transient int b=3;
public static final int c;
volatile int d;
private syncronized int e;
21. Given:
1. public class Test {
2. public static void main(String [] args) {
3. System.out.println(args.length > 4 &&
4. args[4].equals("-d"));
5. }
6. }
If the program is invoked using the command line:
java Test One Two Three -d
What is the result?
true
false
compilation fails
An exception is thrown at runtime.
22. Given:
1. public class X {
2. private static int a;
3. public static void main(String [] args) {
4. modify(a);
5. System.out.println(a);
6. }
7. public static void modify(int a) {
8. a++;
9. }
10 }
What is the result?
0
1
Compilation fails
An exception is thrown at runtime.
15. What is the most restrictive access modifier that can be applied to a member if that member must be accessible to members of a subclass within the same package as the superclass?
public
private
abstract
protected
default access
16. Which can be overridden? (Choose one.)
native void methoda();
final void methoda() {}
void final methoda() {}
synchronized final void methoda() {}
17. Which declaration ensures that a class cannot be subclassed?
abstract class MyClass { }
final public class MyClass { }
final abstract class MyClass { }
static private class MyClass { }
static protected class MyClass { }
18. Which is true about the default constructors? (Choose one.)
The default constructor is always public
The default always invokes the no-arg superclass constructor
The default constructor inherits the arguments of the superclass constructor
The compiler creates a default constructor if the class does not have a no-arg constructor defined
19. Which modifier limits access to a method of a public class to members of the same class?
final
public
private
protected
default access
20. Which of the following class level (nonlocal) variable declarations will not compile?
protected int a;
transient int b=3;
public static final int c;
volatile int d;
private syncronized int e;
21. Given:
1. public class Test {
2. public static void main(String [] args) {
3. System.out.println(args.length > 4 &&
4. args[4].equals("-d"));
5. }
6. }
If the program is invoked using the command line:
java Test One Two Three -d
What is the result?
true
false
compilation fails
An exception is thrown at runtime.
22. Given:
1. public class X {
2. private static int a;
3. public static void main(String [] args) {
4. modify(a);
5. System.out.println(a);
6. }
7. public static void modify(int a) {
8. a++;
9. }
10 }
What is the result?
0
1
Compilation fails
An exception is thrown at runtime.
Valora esta pregunta


0