This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes To clear the basic fundamental Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "To clear the basic fundamental" Watch "To clear the basic fundamental" New topic
Author

To clear the basic fundamental

dimple bav
Ranch Hand

Joined: Sep 12, 2008
Posts: 90
I know it is very silly but i just want to clear the funda:

what is the difference between code1 and code2

code1:

class A
{
}

class test
{
public static void main(String args[])
{
A a = new A();
}

---------------------------------------------------------
code2

class test
{
public static void main(String args[])
{
Test a = new Test();
}

Thank you.
Dimple.
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
what do you want to know?


scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
in the first you are creating an instnce of class A...and in 2nd you are creating an instance of Test class
dimple bav
Ranch Hand

Joined: Sep 12, 2008
Posts: 90
Raju Champaklal wrote:what do you want to know?


But in the code 1 hows the instance of class A is related to Test class
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
since both are in same packages an instance of A class can be created anywhere within the same package or within any class in the file....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: To clear the basic fundamental