The Artima Developer Community
Sponsored Link

Java Buzz Forum
Friday Java Quiz: What Does -source 1.4 Really Mean?

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 Does -source 1.4 Really Mean? Posted: Jul 27, 2007 8:57 AM
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 Does -source 1.4 Really Mean?
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

Today's quiz has to do with the -source and -target command line switches of the javac command. We are all familiar with these switches.

But do we really know how they work?

Suppose I have just built a new Debian 4.0 box, and installed Sun Java 5 on it. There are no other versions of Java installed on the box. Without actually invoking the compiler, answer the following question.

Will the following Foo.java:

public class Foo {
  public static void main(String[] args) {
    StringBuilder sb = new StringBuilder();
    sb.append("Hello, world.\n");
    System.out.println(sb.toString());
  }
}

compile successfully with the following command line:

javac -source 1.4 Foo.java

?

What about the following command line:

javac -source 1.4 -target 1.4 Foo.java

?

Explain why.

Read: Friday Java Quiz: What Does -source 1.4 Really Mean?

Topic: Groovy & Grails User Groups Around The World - Vancouver, London, Stuttgart, Minnesota - Any... Previous Topic   Next Topic Topic: Facebook changes I would like to see

Sponsored Links



Google
  Web Artima.com   

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