473,662 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why cant create an object from same package different files?

1 New Member
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 1779
dmjpro
2,476 Top Contributor
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 Contributor
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 Recognized Expert Top Contributor
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
8630
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 package installed on a network drive. When anyone with write access imports this package, the network drive gets spammed with .pyc files.
1
15251
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
1840
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 Python distribution. Background ========== Some time ago, I wrote such a module for myself, and have found it extremely useful. Recently, I found a reference to a similar module, http://www.jorendorff.com/articles/python/path/ by Jeff Orendorff.
7
8850
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 want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
4
1849
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, but while running, gives the following error in the part that must use a certain COM dll: COM object with CLSID {some hex code} is either not valid or not registered I know which application is using this dll while the error is generated and
6
1646
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 to open the vbProj at this new location, I get the error message that it can't open the app because some components may be missing. If I create the same project at the new location from scratch, it runs fine. Is there a configuration or some...
2
3767
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 re-installed DB2 on the same location we are able to catalog and recover the database with old data files. Now the problem is when i tried to create a database its throwing errors "SQL1092N NCADMIN" does not have the authority to perform the requested". So...
2
2668
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 machine running winXP sp2 and VS2005. I'm using a c# 2.0 winforms app which talks to a c#2.0 asp.net app that also contains 1 web service. Note: the webpage and web service are located side by side in the same web app.
3
3897
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 wrote the code that uses one of the functions. Everything ran just fine. No hiccups. The code performed the calculation as expected. Today I went to install this on a client workstation. I copied the tlb file into the same folder that the access adp...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.