Profiel van Cheet忘了烦恼 可爱多好™Foto'sWeblogLijsten Extra Help

Weblog


    14 januari

    Java Interview Questions

    JQuestions


    What if the main method is declared as private?

    The program compiles properly but at runtime it will give “Main method not public.” message.

    What is meant by pass by reference and pass by value in Java?

    Pass by reference means, passing the address itself rather than passing the value. Pass by value means passing a copy of the value.

    If you’re overriding the method equals() of an object, which other method you might also consider?

    hashCode()

    What is Byte Code?

    Or

    What gives java it’s “write once and run anywhere” nature?

    All Java programs are compiled into class files that contain bytecodes. These byte codes can be run in any platform and hence java is said to be platform independent.

    Expain the reason for each keyword of public static void main(String args[])?

    public- main(..) is the first method called by java environment when a program is executed so it has to accessible from java environment. Hence the access specifier has to be public.

    static: Java environment should be able to call this method without creating an instance of the class , so this method must be declared as static.

    void: main does not return anything so the return type must be void

    The argument String indicates the argument type which is given at the command line and arg is an array for string given during command line.

    What are the differences between == and .equals() ?

    Or

    what is difference between == and equals

    Or

    Difference between == and equals method

    Or

    What would you use to compare two String variables - the operator == or the method equals()?

    Or

    How is it possible for two String objects with identical values not to be equal under the == operator?

    The == operator compares two objects to determine if they are the same object in memory i.e. present in the same memory location. It is possible for two String objects to have the same value, but located in different areas of memory.

    == compares references while .equals compares contents. The method public boolean equals(Object obj) is provided by the Object class and can be overridden. The default implementation returns true only if the object is compared with itself, which is equivalent to the equality operator == being used to compare aliases to the object. String, BitSet, Date, and File override the equals() method. For two String objects, value equality means that they contain the same character sequence. For the Wrapper classes, value equality means that the primitive values are equal.

     public class EqualsTest {
    
    	public static void main(String[] args) {
    
    		String s1 = “abc”;
    		String s2 = s1;
    		String s5 = “abc”;
    		String s3 = new String(”abc”);
    		String s4 = new String(”abc”);
    		System.out.println(”== comparison : ” + (s1 == s5));
    		System.out.println(”== comparison : ” + (s1 == s2));
    		System.out.println(”Using equals method : ” + s1.equals(s2));
    		System.out.println(”== comparison : ” + s3 == s4);
    		System.out.println(”Using equals method : ” + s3.equals(s4));
    	}
    }
    Output
    == comparison : true
    == comparison : true
    Using equals method : true
    false
    Using equals method : true

    What if the static modifier is removed from the signature of the main method?

    Or

    What if I do not provide the String array as the argument to the method?

    Program compiles. But at runtime throws an error “NoSuchMethodError”.

     

    11 januari

    哆啦A梦换装

    你要使用现有的道具把哆啦A梦剧场版中的造型拼出来,要在规定时间完成30个造型,只有真正看过哆啦A梦全部剧场版的人才能达到。

    操作方法:鼠标拖动物品到哆啦A梦身上即可,左边数字圆圈可以选择不同关卡,黑色剪影可以作参考,换装完成后按黄色按钮检查。

     


    09 januari

    谈论 RagingMonk's Widget of Games

     

    引用

      
    04 januari

    【转】大学和高中的可悲区别,感觉到了么?

    校内上转的,有些我也感觉的到呵呵~


     

    中学里喜欢你的人会冲你笑

    大学里讨厌你的人会冲你笑 

     

    中学里几句话就是哥们,下次一起玩就会叫你
    大学里几句话就算认识,下次要帮忙就会找你 

     

    中学里男生有了矛盾会打架,和了之后还是好朋友
    大学里男生有了矛盾会沉默,崩了之后朋友没的做

    中学里女生之间要好可以好到连上厕所都一起去
    大学里表面和你好到一起去厕所的女生你不一定知道她心里想的是什么

    中学里漂亮女生就是凭实力

    大学里漂亮女生一半是画出来的

     

    中学里每天课很多,但仍然有时间做自己喜欢的事情
    大学里每天课不多,但总要做一些自己不喜欢的事情

    中学里教室一下课很热闹

    大学里教室一下课很沉闷

    中学里大家不在乎当不当干部
    大学里一堆人挺把当官当回事

    中学里生活圈子小,朋友圈子大
    大学里生活圈子大,朋友圈子小

    中学里大家心胸很开阔,一点事过去就过去了
    大学里有人心胸不开阔,为一点小事生半天气

    中学里朋友之间嘴上很不客气,其实好的要死
    大学里朋友之间嘴上特别客气,其实未必多好

    中学里觉得现在开放的孩子真多

    大学里发现这代人传统的也不少

    中学里有特长的人受欢迎

    大学里没有人真正受欢迎

    中学里对任何事大家会给出自己的第一反应
    大学里对任何事大家会隐藏自己的第一反应

    中学里别人会正面回答你的问题

    大学里别人会迂回回答你的问题

    中学里玩学生会的人大学都不玩学生会了
    大学里玩学生会的人中学没机会玩学生会

    中学里喝酒是因为开心

    大学里喝酒是因为不开心

    中学里谈恋爱希望让别人知道

    大学里谈恋爱不希望让别人知道

    中学里大家没什么钱,但并不寒酸
    大学里大家宽裕一些,但整天哭穷