0
   

class concept

 
 
Reply Tue 30 Jun, 2009 01:58 pm
class a
{
public void aFn()
{
System.out.println("Im in A");
}
}
class b
{
public void bFn()
{
System.out.println("I'm in B");
}
public static void main(String args[])
{
class a= new a();
a.aFn();
class b= new b();
b.bFn();
}
}

the name of the file saved is b.java

The output is
Im in A
Im in B

My question is that how can we access other class as the default access specifier is package. we haven't imported the package.

Please clear me through the concept of accessing a class .
  • Topic Stats
  • Top Replies
  • Link/Embed
Type: Question • Score: 0 • Views: 112 • Replies: 0
No replies

 
 

Related Topics

The "Death" of the Computer Mouse - Discussion by Phoenix32890
Blue screen of Death - Question by dagmaraka
How does one uninstall a program? - Question by Woollcott
how do you type pi? - Question by C99
Conficker worm - Discussion by msolga
SYSTRAY MISSING - Discussion by Misti26
Broad Jump Client Foundation - Discussion by Mustang
 
  1. able2know
  2. » class concept
Copyright © 2009 Horizontal Verticals :: Page generated in 0.35 seconds on 11/27/2009 at 11:38:38 Top End