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 to this Topic
Type: Question • Score: 0 • Views: 878 • Replies: 0
No top replies

 
 

Related Topics

Clone of Micosoft Office - Question by Advocate
Do You Turn Off Your Computer at Night? - Discussion by Phoenix32890
The "Death" of the Computer Mouse - Discussion by Phoenix32890
Windows 10... - Discussion by Region Philbis
Surface Pro 3: What do you think? - Question by neologist
Windows 8 tips thread - Discussion by Wilso
GOOGLE CHROME - Question by Setanta
.Net and Firefox... - Discussion by gungasnake
Hacking a computer and remote access - Discussion by trying2learn
 
  1. Forums
  2. » class concept
Copyright © 2019 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.04 seconds on 03/24/2019 at 03:25:15