• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

KB question pg 409

 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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??
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12102
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try "java Miner"
 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried it worked.
But wht was the reason
 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i pass java Miner diamond
what will be the output??
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Dinesh,

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

Ber
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15219
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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").
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic