Bookmark Topic Watch Topic
  • New Topic

pls solve this problem  RSS feed

 
Thiagu Gopal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Report post to moderator
My code :


class Circle
{
public static void main(String[] args)
{
if (args.length<=0)
{
Box1 a=new Box1();
a.area();
}
else{
Box1 c=new Box1();
int i=Integer.parseInt(args[0]);
int t=c.circum(i);
System.out.println(t);
}

}
}

class Box1
{
void area()
{
Circle.main("5"); // why cant call main()?
return;
}
int circum(int i)
{
return(6*i);
}

}
----------------------------------------
Compile
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
// why cant call main()?


Because you're passing a String, not a String[]
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
Originally posted by Thiagu Gopal:
My code :


class Circle
{
public static void main(String[] args)
{
if (args.length<=0)
{
Box1 a=new Box1();
a.area();
}
else{
Box1 c=new Box1();
int i=Integer.parseInt(args[0]);
int t=c.circum(i);
System.out.println(t);
}

}
}

class Box1
{
void area()
{
Circle.main("5"); // why cant call main()? return;
}
int circum(int i)
{
return(6*i);
}

}
----------------------------------------
Compile


Pls Come up with the exact question what you really want to know???
What problem you are facing exactly.???
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Report post to moderator
please don't post the same question twice. it wastes everyone's time when they answer a question here, that's already been aswered there.

i am closing this thread. please follow up in the other one.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!