The Artima Developer Community
Sponsored Link

Java Buzz Forum
Friday Java Quiz: What Will It Print

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Weiqi Gao

Posts: 1808
Nickname: weiqigao
Registered: Jun, 2003

Weiqi Gao is a Java programmer.
Friday Java Quiz: What Will It Print Posted: Jun 28, 2007 9:45 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Weiqi Gao.
Original Post: Friday Java Quiz: What Will It Print
Feed Title: Weiqi Gao's Weblog
Feed URL: http://www.weiqigao.com/blog/rss.xml
Feed Description: Sharing My Experience...
Latest Java Buzz Posts
Latest Java Buzz Posts by Weiqi Gao
Latest Posts From Weiqi Gao's Weblog

Advertisement

(This week's Friday Java Quiz is contributed by WeiqiGao.com correspondent Brian Gilstrap.)

View From The Fringe: Suppose you have the following two classes:

public class Test {
    public static void main(String[] args) {
        System.err.println( Foo.class.getName() );
        System.err.println( "Testing, 1, 2, 3..." );
        new Foo();
    }
}

public class Foo {
    static {
        System.err.println( "Foo here." );
    }
    public Foo() {
        System.err.println( "New Foo!" );
    }
}

Without running this program, do you know what the output will be?

Comments are directed to View From The Fringe.


BTW, the class in last week's quiz actually compiles and run fine on Linux systems. The $^A is a legal Java identifier. It is only on the less capable Windows systems that the resulting class file cannot be written to the file system. You would have the same problem with Java classes named COM, PRN, LPT1, COM1, etc.

Read more...

Read: Friday Java Quiz: What Will It Print

Topic: Howdy! Previous Topic   Next Topic Topic: Weightless

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use