Albertina Gonzalez

Greenhorn
+ Follow
since Apr 23, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Albertina Gonzalez

In Engine mock the following exercise:
Which statements concerning the effect of the statement gfx.drawRect(5, 5, 10, 10) are true, given that gfx is a reference to a valid Graphics object?
a). total width of 5 pixels
b). total height of 6 pixeles
c). total width of 10 pixels
d). total height of 11 pixels
And the right answer is d) WHY???
drawRect( int x, int y, int width, int height)
and the values are drawRect (5, 5, 10, 10)
And the pixels is 10 why not??
I know the null, true and false are literals, but for the exam they are considereted keywords no???
is null a reserved key for java
(exam Quiz, jamie jaworkski)
Thanks, that sounds trip cuestion. I know, is the best way to make it a habit of initializing all local variables at the onset. But the exam have trip/traps
Thank you very much
Thanks I had a mistake in my code...
In the javaprepare: questions on language fundamentals
It consider the valid declaration for the main
final static public void main(String args[])
Why is valid...?
I agree, this statements compile but not run...?
What is the correct answer..?
Look the code
public class a {
public static void main(String args[]) {
int x = 10, y;
if(x<10)
y = 1;
if(x>= 10)
y = 2;

System.out.println("El valor de y es" + y);
}}
I dont understand why there is compile error, if x = 10 and come in the second if and y is initialized with 2
Why don�t recognized y = 2???
Hi,
I have a question about this ...
int x =10++11;
I say, that this is a invalid statement, because the operator is applicated over the variable...
What do you know?
Thank you
Thanks, Now I know the begin.
It has been helpful to see the detachhed subjects
Can someone explain me with other words the casting, when reference variable and type of class? (Valentin's Mock exam)

Question 7. Select two correct statements about the code given below?
class A{}
class B extends A implements E{}//line 1
class C extends A{}
class D extends B{}
interface E{}
public class Question07 {
public static void main(String[] args) {
A a = new D();//line 2
C c = new C();//line 3
E e = (E)a;//line 4
B b = (B)e;//line 5
}
}


A. The code compiles without error and runs fine.
B. Compilation error on line 1 because interface E is not yet declared (forward-referencing).
C. Compilation error on line 4 because class A does not implement interface E.
D. The cast on line 4 is mandatory.
E. The cast on line 5 is not mandatory.
First, pay attention to the class hierarchy (B and C are sibling classes!!) Then, there is no such thing as forward-referencing issues when using interfaces declared later in the compilation unit. On line 4, we are dealing with an object whose runtime type is D which implements interface E. The cast is mandatory, though, since the reference type (A) is not assignment compatible with the reference type E. The cast on line 5 is mandatory for the same reasons.
I know that null, false and true are literals.
Are they considereted keywords ?