Everything sux

Wednesday, August 31, 2005

[Java] Conosci Davvero Java?

Java è un linguaggio complicato.
Avendo un sacco di colleghi in disaccordo con questa tesi, mi sono preparato una piccola lista di domande per dimostrare che nemmeno loro si immaginano quanto sia complicato ;)

Se vi ritenete esperti Java dovreste sapere le risposte, se non le sapete, sono tra i commenti



  1. Riscaldamento: cosa stampa questo codice?

    public class Main {
    int myInt;
    double myDouble;
    boolean myBoolean;

    public static void main( String []args){
    Main obj=new Main();
    System.out.print(obj.myInt);
    System.out.print(" " + obj.myDouble);
    System.out.println(
    " " + obj.myBoolean);
    }
    }


  2. Dato il codice

    Calendar cal = Calendar.getInstance();
    cal.set(1999, 12, 31);
    System.out.print(cal.get(Calendar.YEAR) + " ");
    System.out.print(cal.get(Calendar.MONTH) + " ");
    System.out.println(cal.get(Calendar.DAY_OF_MONTH));

    cosa credete che venga stampato a schermo?

  3. In questo codice c'è un evidente errore, siete in grado di individuarlo?

    void copy(File src, File dst) throws IOException {
    FileChannel in = null, out = null;
    try {
    in = new FileInputStream(src).getChannel();
    out = new FileOutputStream(dst).getChannel();
    long size = in.size();
    MappedByteBuffer buf = in.map(FileChannel.MapMode.READ_ONLY, 0, size);
    out.write(buf);
    } finally {
    if (in != null) in.close();
    if (out != null) out.close();
    }
    }



  4. Quanto vale
     1 << 32


  5. Eseguendo questo codice:

    public static void main(String[] args) {
    System.out.println(10/magic(-2147483648));
    }
    static int magic(int x){
    if (x !=0)
    return x+x;
    return 1;
    }

    cosa viene stampato a schermo?


  6. I modifier sono quelle cose tipo public o static. Facile, direte voi. La domanda è: quanti modifier ci sono in java?


  7. Se per qualche assurda ragione avete azzeccato la risposta precedente, sareste in grado di riee quali e spiegare a cosa servono?


  8. Avendo cura di includere java.lang.reflect.*, Cosa stampa questo spezzone:
    System.out.print( Modifier.toString( Member.class.getModifiers() ) );
    ?


  9. Qual'è l'errore in questa innocua classe?

    public class Main {


    public static final double twoPI
    = 2 * myPI;
    public static final double myPI
    = Math.PI;
    }


  10. Potrebbero sembrare banali, ma io mi sbaglio spesso.. Quali tra queste sono assegnazioni valide ?
  • double b = 1.0;
  • float c = .1f;
  • float a = 0.1;
  • float d = 1.f ;
  • float e = 3.2f ;
  • double f = 1. ;
  • float g = 0x23595959L ;
  • float h = 0x595959F ;
  • double i = 0X0;
  • int l = 2147483648;
  • double m = 2036373547;
  • float n = 2147483648;
  • double m = 2147483648


48 Comments:

  • 1: 0 0.0 false. Basta ricordare che le variabili hanno dei valori di default in java.

    2: 2000 1 31. I mesi si contano da zero, per retrocompatibilità con le api deprecate di Date

    3: se viene lanciata un'eccezione da in.close() c'è un resource leak

    4: vale 1

    5: non viene stampato nulla, viene lanciata un'eccezione DiviosionByZero, un problema relativo al fatto che i tipi numerici in java non sono effettivamente astratti come in Ruby/Python/Smalltalk/Lisp, ma sono degli spaziucci di memoria

    6: 11 (!!)

    7: public, private, protected, static, native, volatile, abstract,
    synchronized, strictfp, final, transient. Per le spiegazioni prendete le spec di java :)

    8: "public abstract interface". Se adesso state pensando che una interfaccia stratta sia qualcosa di magico, ricredetevi, tutte le interfacce sono abstract solo che non si sa perché questa cosa viene fuori solo tramite reflection.

    9: javac non è abbastana intelligente da capire che potrebbe leggere la dichiarazione di costante che avviene dopo l'uso (è più intelligente in altri casi)

    10: ultimo, penultimo e quart'ultimo. La cosa affascinante è che 2147483648 non è un int valido, mentre -2147483648 lo è.

    By Blogger verbat, at August 31, 2005 at 10:03 AM  

  • trovo + significativi i test di Javabackbelt.com.

    Hai vouluto dimostrare che ci sono delle cosette sporche in java? ci sono in tutti i linguaggi, in tutti i framework e mi sento di dire in tutte le soluzioni tecnologiche.

    per la domanda 7 esiste anche il fatto di non mettere nulla come modifier, il compilatore lo consente e salta fuori una specie di protected...

    By Blogger ::SammyRulez::, at August 31, 2005 at 11:37 PM  

  • quoto il messaggio precedente e aggiungo: lo stupore su certe risposte piuttosto palesi denotano una scarsa conoscenza del linguaggio. Prima di fare il professore datti allo studio.
    gigi

    By Anonymous Anonymous, at September 1, 2005 at 2:27 AM  

  • Se sono queste le ragioni a sostegno della complessita' di Java, allora viene dimostrato solo il contrario.
    L'unico punto a favore e' la domanda 7, e non basta proprio a fare di Java un linguaggio complesso.

    By Anonymous Anonymous, at September 1, 2005 at 3:57 AM  

  • Sono d'accordo che ci sono delle cosette sporche in qualsiasi ambienti (sebbene in certi più che in altri)

    E' ovvio che alcuni risposte fossero palesi, volete un giochino un cui non si azzecca nemmeno una risposta?
    Se vuoi ci metto poco, ma parlare di generic ed enum, di varianza, di f bounded polimorphism etc.. quello sarebbe fare davvero il professore, secondo me.

    By Blogger verbat, at September 1, 2005 at 4:02 AM  

  • This comment has been removed by a blog administrator.

    By Blogger Free Site Submit, at September 1, 2005 at 4:42 AM  

  • This comment has been removed by a blog administrator.

    By Anonymous Anonymous, at September 1, 2005 at 4:48 AM  

  • Potresti motivare la risposta 10, compreso il sarcasmo riguarda la 'cosa affascinante'?

    By Anonymous Giuseppe M, at September 2, 2005 at 3:09 AM  

  • siccome un int ha solo 32 bit di precisione, può rappresentare solamente 4294967296 numeri. Siccome uno di questi è lo zero, i numeri non-zero rappresentabili sono "asimettrici" rispetto a questo.

    Lo trovo affascinante perché sono abituato a pensare che due numeri con un meno davanti sono in un certo senso la stessa cosa. Posso in ogni caso dire che x è la stessa cosa che (-(-x)).
    Tra l'altro se non ricordo male lo standard C recente si comportà così, rifiutando sia 2147483648 che -2147483648 come int.

    By Blogger verbat, at September 2, 2005 at 8:46 AM  

  • Among these magnificent benefits is the chance to be able to promote your business, any business,

    By Anonymous Anonymous, at November 4, 2005 at 12:40 AM  

  • Quello che realmente stupisce è il numero di individui che non sono disposti ad ammettere le enormi, spaventose, terrificanti magagne di java.
    D'altro canto fin dai tempi delle diatribe C64 vs Spectrum c'erano sedicenti programmatori disposti a giurare sulla assoluta superiorità del BASIC rispetto all'assembly.

    By Anonymous Anonymous, at November 18, 2005 at 10:01 PM  

  • Hi verb! Thanks for the great information on [Java] Conosci Davvero Java?.

    If you have time check out my list page. It is a huge list of thousands of different and interesting things for sale online!

    By Anonymous catalog, at December 22, 2005 at 7:09 PM  

  • Hi verb! Thanks for the great information on [Java] Conosci Davvero Java?.

    If you have time check out my clickbank page. It is a huge list of thousands of different and interesting things for sale online!

    By Anonymous clickbank, at December 23, 2005 at 12:03 AM  

  • I read over your blog, and i found it inquisitive, you may find My Blog interesting. My blog is just about my day to day life, as a park ranger. So please Click Here To Read My Blog

    By Blogger darrelhill3016, at December 31, 2005 at 11:31 AM  

  • Hi,
    I was searching through Blogger to see if I can find some information on Business Opportunity. I stumbled on your blog, as this was not quite what I was looking for about Business Opportunity. I did however read your blog and found it quite interesting, keep up the good work and hopefully I will visit it again.
    Regards,

    By Anonymous Making Money, at January 3, 2006 at 3:20 AM  

  • I read over your blog, and i found it inquisitive, you may find My Blog interesting. So please Click Here To Read My Blog

    http://pennystockinvestment.blogspot.com

    By Blogger eddymartin04248733, at January 22, 2006 at 12:32 AM  

  • Get any Desired College Degree, In less then 2 weeks.

    Call this number now 24 hours a day 7 days a week (413) 208-3069

    Get these Degrees NOW!!!

    "BA", "BSc", "MA", "MSc", "MBA", "PHD",

    Get everything within 2 weeks.
    100% verifiable, this is a real deal

    Act now you owe it to your future.

    (413) 208-3069 call now 24 hours a day, 7 days a week.

    By Blogger howardandres10759758, at May 6, 2006 at 5:57 AM  

  • hey, I just got a free $500.00 Gift Card. you can redeem yours at Abercrombie & Fitch All you have to do to get yours is Click Here to get a $500 free gift card for your backtoschool wardrobe

    By Blogger lkyx0svv99wdvb, at October 8, 2006 at 12:44 PM  

  • hey, I just got a free $500.00 Gift Card. you can redeem yours at Abercrombie & Fitch All you have to do to get yours is Click Here to get a $500 free gift card for your backtoschool wardrobe

    By Blogger gkaf3hzlk09awhu, at October 10, 2006 at 7:22 AM  

  • Well, thish-yer Smiley had rat-tarriers, and chicken cocks, andtom-cats and all online brueste arschfick of them kind of things, till you couldn't rest, andyou couldn't fetch nothing for him to bet on but he'd match you.The Anecdotes andReminiscences was completed, but publishers had not jumped at thecollected gems of fette titten kostenlos Alabama sense and wit.No onecould have detected his disappointment in his manner, nacktbilder exfreundinnen albeit hissentences were short and incomplete.Through my fault a girl erotik messe tried to protectherself from the consequences of a liaison with me by securing anabortion.

    By Blogger sink sink socks, at January 2, 2007 at 11:14 PM  

  • Hi all!
    New Game
    http://italiagame.org

    Bye

    By Anonymous Anonymous, at January 21, 2007 at 2:29 AM  

  • http://italiagame.org/site

    By Anonymous Anonymous, at January 30, 2007 at 7:08 PM  

  • finance idustrial all fico score.
    bugiallis.
    chasecreditcard.
    chase credit card.
    refinance mortgage loan.
    [url=http://refinance-mortgage-loan.110mb.com][/url]

    By Anonymous Anonymous, at January 31, 2007 at 3:47 AM  

  • Buon giorno.
    quella era una cosa piacevole, e potete aiutarli che cerco
    http://probabile-formazione-calcio-serie.corsi-di-formazione.org probabile formazione calcio serie

    Quello e tutto.

    By Anonymous Anonymous, at February 26, 2007 at 10:20 AM  

  • Have you tried Phentramine or Hoodia Diet Pills? They have a good selection here Hoodia Weightloss Pills

    By Blogger No Hassle Loans, at March 11, 2007 at 3:26 PM  

  • Regretting any inconvenience that thistransaction may cause you, I am,Yours medical gyno fetish respectfully,EDWARD EASTMAN ELLSWORTH.On the contrary, there will be atendency in the primary apparatus to abandon the painful memory pictureas soon as it is in any way awakened, as the sex live fotos overflow of its excitementwould surely produce (more precisely, begin to produce) pain.But from the moment that the suppressed thoughts are powerfully occupiedby the unconscious wish-feeling and abandoned by the foreconsciousoccupation, they succumb to the primary psychic process and strive onlyfor motor discharge; or, if the path be free, russian teen pussy for hallucinatory revivalof the desired perception identity.Should he give away his brilliant inside information,drawn from the Hints and Helps book, and be cowgirls rivalled in the glory ofhis manners and bearing? Why should he not pass on alone, perfectlycomposed, and reap the field of glory unsupported? His knees gave wayand he sat down without intending it.

    By Blogger sink sink socks, at March 20, 2007 at 1:18 AM  

  • After having discussed his repast, and washed it down with a bottle ofchoice old claret, he resolved upon a visit to japa porno Long Island to view hispurchase.The analysis of obscure andintricate dreams discloses something india sex bilder very similar; the dream scene againpictures as realized some desire which regularly proceeds from the dreamideas, but the picture is unrecognizable, and is only cleared up in theanalysis.Jacobus say, to enter in seitensprung sex no man's pry -vacy; but I do want to know who it may be, like, that I hev inmy house.Gideon bowed to right and toleft, low, grinning, assured comedy obeisances; but gratis kontakt as the laughterand applause grew he shook his head, and signaled quietly for thedrop.

    By Blogger sink sink socks, at March 26, 2007 at 12:46 AM  

  • But on the firstappearance of my double--whom I sent on this fatal Monday to the www fifthmeeting--he was the sixty-seventh man who entered the room.Chillcross-draughts whistled in from cracks too numerous to be stopped up,and the miserable Van Kamps could only cough and shiver, and envy theTutts and the www driver, non-combatants who had been fed two hoursbefore.Forgetting everything except hischerished ambition, he braced himself for the contest, took a twisthold on the lines, sent a sharp, quick call to his horse, and let himout for all that was in him www.Leonard is one of www the kindest, most generous, and most benevolent ofwomen--she does good in every possible way.

    By Blogger sink sink socks, at March 28, 2007 at 12:15 AM  

  • flower shops in billings mt transcona florist
    flower girl dress pattern big old tucci flower tucci florist in auburn alabama flowers in the dirt album
    how to make royal icing flowers

    By Anonymous Anonymous, at September 23, 2010 at 5:11 PM  

  • Androxan hingegen wirkt nachhaltig und und ohne die Cialis Soft Tabs fur unterwegs geeignet. Sie notwendige und medizinisch richtige Potenzmittel wie unangenehm und peinlich andere Krankheiten verursacht. Ausland In unserer zertifizierten Apotheke erhalten Sie rezeptfrei original Cialis, Cialis wirken deutlich schneller als Potenzpillen wie bestimmte.
    [URL=http://buy-tadalafil-cialis-online.info/kaufen-cialis-in-deutschland-rezeptfrei-.html]Kaufen cialis in deutschland rezeptfrei [/URL]

    By Anonymous Anonymous, at September 25, 2010 at 3:55 PM  

  • black cat music cd c c music factory midi
    ta-da lil mo music video istock music sheet music for alkaline trio churchtown school of music
    timeline of music devices

    By Anonymous Anonymous, at October 1, 2010 at 5:00 PM  

  • shreveport country music sharpies music from the movie troy
    lounge lizard royalty free music the music artist bimbo william betz ohio university music gutar tab music donlodes
    zelda's lullaby sheet music

    By Anonymous Anonymous, at October 3, 2010 at 12:03 AM  

  • http://ariadnerestaurant.com/diss/index.html free printable disney coloring pages disney world golden age club

    By Anonymous Anonymous, at October 6, 2010 at 8:04 AM  

  • What is does accutane cause blindness or accutane gallstones and accutane theraputic?
    You can Buy Accutane Online in canada and usa cheap now.
    A accutane lawsuits.

    By Anonymous Anonymous, at October 20, 2010 at 9:28 AM  

  • текст песни
    [url=http://remuz.ru/407-юрий-антонов.html]слушать юрий антонов[/url]
    бесплатная музыка
    [url=http://remuz.ru/345-noize-mc.html]mp3 noize mc[/url]

    By Anonymous Anonymous, at November 30, 2010 at 11:19 PM  

  • [b][url=http://www.onlinesaleswebsite.com/]louis vuitton handbags[/url][/b] When Louis Vuitton Outlet there has to be pertaining to a number of blotches as a result it can be a certainly hit giveaway. You ought to take into consideration that actual Low cost Louis Vuitton handbags has bought Louis Vuitton Format mostly with a one room. From your get go, Louis Vuitton has bought extended story famed completely ready for its substantial qualitative truly feel meant for synthetic leather-based, mainly the ones leathers going through happen to be put to utilize for decades.

    [b][url=http://www.uggsoutletnow.com/]ugg outlet[/url][/b] He in simple english proved useful as much as scratch the completely new accessible member of staff members. Very last although not minimum he affiliated Mark Vivier-Los angeles louis vuitton oslo large running shoe-generating firm. Does one think you might be just hooked towards the Louis Vuitton Graffiti or tulips the actual new Louis Vuitton Stephen Sprouse Assortment? In my condition, the answer is totally yes.

    [b][url=http://www.louisvuittonsalemarket.com/]louis vuitton sale[/url][/b] This can be so simple as just a little bit of paper around the fridge, or perhaps a page with your day planner. Just generate a little checkmark, or dash about the bit of paper each time you consume a glass of drinking water. The log will assist you to keep monitor of just how much drinking water you have experienced in almost any given day.

    [b][url=http://www.louisvuittonsalemarket.com/]louis vuitton handbags[/url][/b] More investigate is required to grasp if and for a way lengthy the molluscum virus can stay in swimming pool drinking water and if such drinking water can infect swimmers. Open sores and breaks from the skin can be infected by various germs. Thus, folks with open up sores or breaks from any trigger really should not go into swimming swimming pools..

    [b][url=http://www.uggsclearancebusiness.com/]uggs[/url][/b] You'll want to go for your reproduction LV purse for the reason that top quality on the workmanship is simply as good as that in the authentic matter. For most circumstances, the products made use of are people which have been utilized in genuine Louis Vuitton bags. The substantial high-quality of these bags is simply because they are made to move for the authentic matter..

    [b][url=http://www.louisvuittonsalemarket.com/]www.louisvuittonsalemarket.com[/url][/b] Starting to be crack narrowing decreased on phony offerings tightens, we're eventually commence to have a preference for initialed or monogrammed dog crate into brands like Louis Vuitton, that should be form involving possibly the numerous replicated propensities truly globe. They might be present you read through about ins and outs alongside goods that boost the comfort and ease may definitely distinct on the younger unqualified clearly show, intriquing , notable and a element flavors filled using a super uncomplicated instance sentiments just another. Inside biceps some type of consumer decide for sensible totes producing attempts carriers, typically answers is utilized yellow.

    By Anonymous Anonymous, at December 18, 2012 at 2:39 PM  

  • Битторрент трекер KINORELIZ.NET дает возможность бесплатно загрузить бесплатно торрент фильмы, музыку, игры, книги, программы, документацию. Бесплатный торрент трекер - идеальный вариант ускорить просмотр кино или прослушивание музыки.

    KINORELIZ NET: [url=http://kinoreliz.net]открытый торрент трекер[/url]

    By Anonymous Anonymous, at December 23, 2012 at 12:23 PM  

  • [b][url=http://www.louisvuittonhandbagsgo.com/]louis vuitton purses[/url][/b] Seductively elegant and smooth the Shoreham don't just assures an interesting visible knowledge its 174 luxuriously appointed and tech-savvy guestrooms and suites guarantee the best typical of comfort benefit and amenities all of that are complimented by an attentive welcoming personnel. The hotel features a new cafe lounge highlighted by colourful remarkable Living Glass partitions and an epicurean menu a state-of-the-art cardiovascular techno-gym physical fitness middle geared up by Technogym and its personal art gallery showcasing original functions from electronic interactive and common artists. Extraordinary assembly areas including an Atrium Loft Penthouse Suite with stunning sights of your NYC skyline are available for functions enterprise gatherings or any particular event.

    [b][url=http://www.beautifulbagsstore.com/]www.beautifulbagsstore.com[/url][/b] Is VOIP Correct for Me? Choosing to pick VOIP relies upon on the needs. In case you come up with a large variety of lengthy distance calls, it could be effectively worthy of on the lookout into. VOIP expert services are sometimes considerably much less highly-priced than common suppliers. Move about a bag of M Notify every person to get as several because they would love. Promptly ask them to count the amount of candies inside their hand. Every single particular person then requires a transform standing up and telling as a lot of things about on their own along with their relatives as they have M Of course nobody is allowed to consume their M right until they have had their convert..

    [b][url=http://www.louisvuittonhandbagsgo.com/]louis vuitton outlet[/url][/b] Reputation of big marketing campaign in the globe, men and women translate into carrying large dimension purses, which Gucci Handbags also avilable. If you want to create by yourself trend in huge bags, it is best to look into the Boston or Enjoyment purses that Gucci has obtainable. These bags are total with double straps for making carrying easier, as well as double G emblem that may be section of the signature Gucci manufacturer, or maybe the monogram design and style, will furnish your bag with character.

    [b][url=http://www.louisvuittonhandbagsgo.com/]www.louisvuittonhandbagsgo.com[/url][/b] Nonetheless, the thought louis Vuitton Bags eludes most providers bogus Louis Vuitton. louis vuitton outlets are extremely satisfied with their logo. Should the skin is printed aided by the LV monogram is minimize, well being treatment is highest are taken to ensure that each one foundation effectively VL.

    By Anonymous Anonymous, at January 2, 2013 at 5:02 PM  

  • Sett peniѕ (еller leketøу) bеstemt mot åρningеn, men ikke press inn.
    Jeg har mine foreѕtillinger om hvа jеg leteг еtter og ԁet er modne damer som er åpen for Sωinger.
    Іkke tabu, barе veldіg, veldig fremmed – og til ԁеls fullstendіg usexy.
    Feel free to surf my web blog - sex kontakt annonser

    By Anonymous Anonymous, at February 12, 2013 at 3:29 AM  

  • Если вы столкнулись с вопросом, как зарегистрировать предприятие, не владея надлежащей юридической подготовкой, то лучше обратиться в ООО "Регистратор". Ведь для самостоятельного оформления всех надлежащих документов необходимо время и знания, так как любая ошибка может обойтись слишком дорого. Высококвалифицированные специалисты ООО "Регистратор" возьмутся качественно оформить фирму.

    Регистрация ООО - [url=http://www.registratorfirm.ru/howtoregfirm/]как создать ооо[/url]

    By Anonymous Anonymous, at February 12, 2013 at 8:13 AM  

  • http://www.markbattypublisher.com/jsp/buytramadol/#buy illegal buy tramadol online uk - tramadol hcl withdrawal

    By Anonymous Anonymous, at March 19, 2013 at 5:23 AM  

  • That is a great tip esρеcially to thosе new to the blogosρhere.
    Simрle but very preciѕe information… Ϻany thanks for sharing thіs one.
    А must гead аrticle!

    Chеck out my homepage :: http://www.sfgate.com/business/prweb/article/V2-Cigs-Review-Authentic-Smoking-Experience-or-4075176.php

    By Anonymous Anonymous, at April 6, 2013 at 2:25 PM  

  • I am regular reader, how are you everybody? This paragraph posted
    at this web site is really nice.

    Check out my web-site :: greek yogurt coupons chobani

    By Anonymous Anonymous, at May 4, 2013 at 9:16 AM  

  • Since the admin of this web page is working, no doubt very shortly it will be famous, due to
    its feature contents.

    My web page ... neutrogena coupons January 2013

    By Anonymous Anonymous, at May 5, 2013 at 3:52 AM  

  • Have you ever considered writing an ebook or guest authoring on other blogs?
    I have a blog based upon on the same subjects you discuss
    and would love to have you share some stories/information.
    I know my visitors would enjoy your work. If you are even remotely interested, feel
    free to shoot me an email.

    my website john torode beef Ragu

    By Anonymous Anonymous, at May 5, 2013 at 5:05 AM  

  • It's amazing to pay a visit this web site and reading the views of all friends about this piece of writing, while I am also zealous of getting knowledge.

    My web site ... can i wash my face with dial soap

    By Anonymous Anonymous, at May 5, 2013 at 5:56 AM  

  • Do you need to boost your outfit or style? Or maybe you
    wish acquiring a gift for your pal? Either way, really helpful.


    Also visit my blog; tag heuer carrera 1887

    By Anonymous Anonymous, at May 21, 2013 at 7:07 AM  

  • There is no denying the fact that purchasing a car can be a
    nerve-wracking, stress-filled experience. Before you make a decision and spend a
    great amount of money on a vehicle, it pays to acquire a bit of knowledge
    on the subject. Keep the tips that follow close at hand,
    and you will have what it takes to make an
    optimal decision.

    My weblog: cars

    By Anonymous Anonymous, at May 27, 2013 at 12:54 PM  

Post a Comment

<< Home