开发者

How to access classess in main class within same package

I 开发者_C百科got one problem while accessing classes in main class within a same package.... it shows error like "bad class name\name.class ......

public class Showall
{
  void print()
  {
    System.out.println("We Will show all the details");
  }

  public static void main(String args[])
  {
    Showall sa=new Showall();
    sa.print();
    Name n=new Name();
    n.showname();
  }
}

............................. here Name is class which is placed in same package. ..................................

class Name
{
  void showname()
  {
    System.out.println("Satwinder");
  }
}


Class names can only contains IDs (basically a-z, A-Z, 0-9 and _) and .

Edit your question to show the code how you try to access the class.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜