473,382 Members | 1,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

why cant create an object from same package different files?

i tried to create an object of a class created with a different file and it worked. But when i try to create the object after packaging it didnt compile. why is that? pls if u know the correct reason email me or post here (XXX@XXX)

WORKED CODES......

//A.java
class A{

A(){
B b=new B();
}// const end

public static void main(String[] arg){
new A();
}// main end
}// class end


//B.java
class B{
}


DIDNT WORKED.............

//A.java
package pac;
class A{

A(){
B b=new B();
}// const end

public static void main(String[] arg){
new A();
}// main end
}// class end


//B.java
package pac;
class B{
}
Jan 16 '08 #1
3 1765
dmjpro
2,476 2GB
i tried to create an object of a class created with a different file and it worked. But when i try to create the object after packaging it didnt compile. why is that? pls if u know the correct reason email me or post here (XXX@XXX)

WORKED CODES......

//A.java
class A{

A(){
B b=new B();
}// const end

public static void main(String[] arg){
new A();
}// main end
}// class end


//B.java
class B{
}


DIDNT WORKED.............

//A.java
package pac;
class A{

A(){
B b=new B();
}// const end

public static void main(String[] arg){
new A();
}// main end
}// class end


//B.java
package pac;
class B{
}
First of all you looking for answer in mail. It is not valid here.
Then you are not using Code Tag.
Read out the posting guidelines carefully.
Did you read about package?
If your class is in different package then import this before accessing that class.

Debasis Jana
Jan 16 '08 #2
ajos
283 100+
First of all you looking for answer in mail. It is not valid here.
Then you are not using Code Tag.
Read out the posting guidelines carefully.
Did you read about package?
If your class is in different package then import this before accessing that class.

Debasis Jana
I dont think he mentioned different package. :).
BTW it would be intresting to know what errors you are getting .
regards,
ajos
Jan 16 '08 #3
BigDaddyLH
1,216 Expert 1GB
pls if u know the correct reason email me or post here (XXX@XXX)
Email replies are discouraged because it doesn't help other forum members with the same problem who find this thread.
Jan 16 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Lonnie Princehouse | last post by:
In short: Is there any way to run Python WITHOUT trying to create .pyc files (or ..pyo) or to have Python not attempt to import the .pyc files it finds? Reason: We have a site-specific...
1
by: Prashanth Uppunda | last post by:
Hello, Does anybody have an idea on how to instantiate a DCOM server residing in another machine using C#? Thanks Prashanth
2
by: Kenneth McDonald | last post by:
I'd like to propose a new PEP , for a standard library module that deals with files and file paths in an object oriented manner. I believe this module should be included as part of the standard...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
4
by: Shiraz | last post by:
Hi I just made an installer package for an application in .NET which also uses COM dlls. It seems to work fine on my machine but when tried it on a co-worker's machine, the application installs,...
6
by: Rich | last post by:
Hello, When I copy a VB web app from my workstation to my laptop (which has the exact same software as the workstation) or to a different virtual directory on the same workstation and then try...
2
by: Anantha | last post by:
Dear All, One day our Windows 2000 Server OS crashed, so our NT admin has re-installed the OS on C: drive. Fortunately we kept our database file and installation in F: drive. When we...
2
by: moondaddy | last post by:
I had to repost this because I had to update and change my msdn alias. I will re-ask the question and clarify a few things that were not clear before. This code is all executed on my dev...
3
by: Keith G Hicks | last post by:
I created a dll for com (in vb.net 2005) so that I could access it's functions from an ms access app. I created the tlb file successfully. On my dev machine I referenced it in my access app and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.