ssb
ssb

Reputation: 1

How to access classess in main class within same package

I 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");
  }
}

Upvotes: 0

Views: 217

Answers (1)

Aaron Digulla
Aaron Digulla

Reputation: 328614

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.

Upvotes: 2

Related Questions