hi all.. pls help me out with this one.. Given that the variable graphic references a valid java.awt.Graphics object, what does the following statement do? graphic.fillRect(2, 3, 10, 20); Select all valid answers.
(1) draw the outline of a rectangle in the current background color
(2) draw the outline of a rectangle in the current foreground color
(3) fill in a rectangle using the current background color
(4) fill in a rectangle using the current foreground color
(5) fill in a rectangle in black
shouldn't 1) and 4) be correct?? I attempted this ques on www.javaquestionbank.com and it says the correct answers are 2) and 3)!! thanx.. ------------------ Hima
Hima<BR>Sun Certified Java Programmer
Axel Janssen
Ranch Hand
Joined: Jan 08, 2001
Posts: 2164
posted
0
Hi, without being a Java-Graphics expert (by the way they allways say that Graphics is NOT part of SJCP) it should be 4. Up to my knowledge drawRect(2, 3, 10, 20) would generate answer 2. hope this helps Axel
Hima Mangal
Ranch Hand
Joined: Feb 25, 2001
Posts: 82
posted
0
hi Axel.. thanx for the reply... but the mock exam asked to choose 2 correct answers.. will u pls shed any light on this?? thanx.. ------------------ Hima
Hima Mangal
Ranch Hand
Joined: Feb 25, 2001
Posts: 82
posted
0
hi all.. can't anybody give me the answer to my query??!! .. c'mon guys.. pls bail me out!! ------------------ Hima
Sarang Gurao
Greenhorn
Joined: Mar 14, 2001
Posts: 13
posted
0
Hello , U can refer K.mughal for this topic. The answer 2 and 3 are right answer as far as i think. the truth abt graphic.fillRect(2, 3, 10, 20); is as follows: 1. its top left position will be 2,3 2. it will have a side of 10-1 which is 9 and the other side of 20-1=19 .that is the rectangle which will be fill with rectangle with forground will have area of (9*19). with the actual rectangle will have a area of 10*20. which will have a color of background color. so the actual rectangle if have forground color red and background black will fill the rectangle with the red color having area 19*9 and it will have a borderline of black of 1 pixel. i hope u get it. and clarify ur doubt.
James Du
Ranch Hand
Joined: Mar 23, 2001
Posts: 186
posted
0
Hi, Sarang. According to your reasoning, I figured that the right answer should be 1)&4) rather than 2)&3)
Hima Mangal
Ranch Hand
Joined: Feb 25, 2001
Posts: 82
posted
0
hi.. Sarang, i also agree with James.. could u pls give ur answer a rethink?? thanx.. ------------------ Hima
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.