aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes KB question pg 409 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "KB question pg 409" Watch "KB question pg 409" New topic
Author

KB question pg 409

Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
class Mineral{}
class Gem extends Mineral
{}

class Miner
{
static int i =8;
static String s = null;
public static void getWt(Mineral m)
{
int y=0/x;
Sysytem.out.println(s);

public static void main(String a[])
{
Mineral ma[]= {new Mineral(), new Gem()};
for(Object o : ma)
getWt((Mineral) o);

comandline java Miner.java

gives error NoClassDefFoundError

Please explain why??


Thanks<br />Dinesh
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11320
    
  16

try "java Miner"


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
I tried it worked.
But wht was the reason
Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
if i pass java Miner diamond
what will be the output??
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8815
    
    5
Hey Dinesh,

What part of the answer in the book was confusing to you?

Ber


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14156
    
  19

Originally posted by Dinesh Tahiliani:
I tried it worked.
But wht was the reason

The "java" launcher expects a class name (such as "Miner") as the argument. Not the name of a Java source code file ("Miner.java").


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: KB question pg 409