[Java lista] SCJP vizsga

Fisha fisha at freemail.hu
2007. Aug. 15., Sze, 15:26:19 CEST


Hello!

De, de annak se volt koze a javahoz. :)

Fisha                            mailto:fisha at freemail.hu

> Es hanyszor fordult mar elo velem, hogy pontosan ugyanilyen feladatot kaptam!

> (Vagy te meg sosem kergettel masfel napon keresztul egy rejtelyes
> bugot, amit egy-ket jol iranyzott eliras vagy epp kis akaratlan field
> hiding, esetleg finally blockban benyelodott exception okzoott?)

> lsp

> On 8/15/07, Fisha <fisha at freemail.hu> wrote:
>> Hello!
>>
>> Hat max annyi, hogy ennyi erovel "talald meg a tiz kulonbseget a ket
>> kep kozott" feladatokat is adhatnanak, kb. ugyanennyi koze lenne a
>> javahoz...
>>
>> Fisha                            mailto:fisha at freemail.hu
>>
>> > Ebben hol a szivatás? Simán látszik, hogy THURSDAY nem deklarált sehol.
>>
>> > Stivi
>>
>> > Original Message:
>> > -----------------
>> > From: Jozsef Tabanyi joco at kac.duf.hu
>> > Date: Wed, 15 Aug 2007 14:44:53 +0200 (CEST)
>> > To: javalist at javagrund.hu
>> > Subject: Re: [Java lista] SCJP vizsga
>>
>>
>>
>> > Csak egy pelda a szivatos kerdesekre:
>>
>> >  Given:
>>
>>
>> >  1.  enum Days {MONDAY, TUESDAY, WEDNESDAY}
>> >  2.
>> >  3.  class Test {
>> >  4.    public static void main(String [] args) {
>> >  5.      int x = 0;
>> >  6.      Days d = Days.TUESDAY;
>> >  7.      switch(d) {
>> >  8.        case MONDAY: x++;
>> >  9.        case TUESDAY: x = x + 10;
>> > 10.        case WEDNESDAY: x = x + 100;
>> > 11.        case THURSDAY: x = x + 1000;
>> > 12.      }
>> > 13.      System.out.println("x = " + x);
>> > 14.    }
>> > 15.  }
>>
>>
>> > What is the result?
>>
>>
>> > A
>> >         x = 10
>> > B
>> >         x = 110
>> > C
>> >         x = 1110
>> > D
>> >         Compilation fails.
>> > E
>> >         An exception is thrown at runtime.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> > Option D is correct.
>> > Compilation fails because THURSDAY was never enumerated.
>> > It is valid to use a correctly defined and referenced enum in a switch.
>>
>> > joco
>>
>> > Jozsef Tabanyi
>> > mailto:jozsef at tabanyi.hu
>> > http://www.tabanyi.hu
>>
>> > _______________________________________________
>> > Javalist mailing list
>> > Javalist at javagrund.hu
>> > http://javagrund.hu/mailman/listinfo/javalist
>>
>>
>> > --------------------------------------------------------------------
>> > mail2web.com ? What can On Demand Business Solutions do for you?
>> > http://link.mail2web.com/Business/SharePoint
>>
>>
>> > _______________________________________________
>> > Javalist mailing list
>> > Javalist at javagrund.hu
>> > http://javagrund.hu/mailman/listinfo/javalist
>>
>> _______________________________________________
>> Javalist mailing list
>> Javalist at javagrund.hu
>> http://javagrund.hu/mailman/listinfo/javalist
>>
> _______________________________________________
> Javalist mailing list
> Javalist at javagrund.hu
> http://javagrund.hu/mailman/listinfo/javalist



További információk a(z) Javalist levelezőlistáról