Welcome Guest | Sign in | Register
File - Discussion Page For Q.2684 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > File > Questions and Answers

Q: You have a class file name Test.class inside javaproject directory.
Test.java source code is :
import java.util.Properties;
class Test {
public static void main (String[] args){
Properties p = System.getProperties();
System.out.println(p.getProperty("key1"));
}
}
you have issued below commands from command prompt.
cd javaproject
java -D key1=value1 Test
What is the output ?
A. value1 B. null
C. Run successfully but no output D. Run fails - java.lang.NoClassDefFoundError: key1=value1

Answer and Explanation

Answer:Run fails - java.lang.NoClassDefFoundError: key1=value1

Explanation:
-D option , name=value pair must follow immediately, no spaces allowed. In this case
there is space between -D and key1=value1 So java.lang.NoClassDefFoundError:
key1=value1.

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.