Jody Brown

Ranch Hand
+ Follow
since Nov 09, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jody Brown

On a more general note, it is a very bad practice to just swallow exceptions in this manner. Never ever do it or debugging the sort of errors you are seeing will be a serious headache. A System.out.println should be used at the very least, but preferably a e.printStackTrace() in the absence of a more complete logging framework.
17 years ago
Without knowing the exact framework your application is using I can only offer a fairly generic suggestion. It sounds like you need to make sure all of the data is persisted by either using the session, or is sent backwards and forwards in the request/response each time. You may well be trying to do this, but you may want to check the scope of whatever it is that you are using to store the variables. They may well be getting reset/overwritten between each and every response, especially if you are creating new bean instances whenever a page loads.

A bit generalised, I know, but I hope it helps somewhat.
17 years ago
Without knowing the exact framework your application is using I can only offer a fairly generic suggestion. It sounds like you need to make sure all of the data is persisted by either using the session, or is sent backwards and forwards in the request/response each time. You may well be trying to do this, but you may want to check the scope of whatever it is that you are using to store the variables. They may well be getting reset/overwritten between each and every response, especially if you are creating new bean instances whenever a page loads.

A bit generalised, I know, but I hope it helps somewhat.
17 years ago
Class.newInstance() should do the same thing.
17 years ago
"D:\SCJP\CoreJava\com\mypackagaes\stuff\Employee.java"

I assume the typo in "mypackagaes" is an error in the post and not in your actual package structure? I would assume it is the post because you said a fully qualified import works, but I have to point this out anyway.

Is there a reason why you can't do a fully qualified import and not use the wildcard? Are you simply curious as to why it doesnt work using *?

Also, does moving PackageTest to its own package fix the issue? It is usually considered fairly bad practice to use the default package as a dumping ground.

Alas I still cannot see why it doesn't work as you want it yet, I will keep thinking on it.
17 years ago

Originally posted by Tina Guilder:
fileinputstream???



That sounds like a winner to me. Or a FileInputStream to be precise.
[ August 23, 2006: Message edited by: Jody Brown ]
17 years ago
I believe this question has been answered in-depth countless times on these forums. If you search for "Java" and "object oriented" I am sure you will find answers far more detailed than I can provide.
17 years ago
If you mark the class implementing the interface as abstract, you only need to provide either partial, or default implementations of the method stubs defined in the interface. This type of class is typically called an Adapter. The remaining methods will then need to be implemented fully in a concrete subclass that inherits from this Adapter.

Be aware however, that by marking a class as abstract, you cannot instantiate it. You will have to instantiate a concrete subclass that has implementations of all of the methods defined by the interface.
17 years ago
By saying House b2=b1, you have defined a second reference to the object that b1 is also pointing to at that point in time. b2 does not point to the reference defined in b1. By making b1's reference null, you are only breaking the reference to the object. You are not destroying the object itself. The object will still exist on the heap because b2's reference to it is maintained.

At least I think that is how it works.
17 years ago
Changing the Exception type wont alter a thing - there is still a fundamental reason why your attempt to create an instance of ServerSocket is failing. in your catch block, try the following, and post the results it displays here for us to take a look at:

17 years ago
It is like comparing apples and oranges. Aggregation is usually described in the text books as "has a". Inheritance is usually described as "is a".

An example of this is Class Car "is a" Vehicle. Thus Car would inherit from Vehicle. However Class Car "has a" Engine. Thus Engine is an aggregate of Car. You can never say an Engine "is a" Car, or vice versa.

Hope this helps.
17 years ago
If you are going for your Sun Certified Java Programmers exam, forget about J2EE. Those are the enterprise APIs built off of the back of the base Java programming language. The SCJP exam covers strictly Java language fundamentals. The later certification exams go into the details of J2EE in more depth. Get one of the good Programmer Certification Guides, advertised here on the Ranch and you shouldn't have any problems after a bit of time and effort invested in studying the material and practicing the exam using a few mock tests.
17 years ago
Do you see something wrong with your main(String[] args) method? look at how you have defined it, and then check one of your reference books on how to define a main method. You are missing a very important word in there.

And will that "throws IOException" cause trouble too? Not sure about that one off the top of my head.
17 years ago
This JDBC tutorial and this Java CSV file manipulation tutorial would be a good place to start.

There are dozens of examples just like this all over the web. The above are two hits I got right off the bat via Google.

In a nutshell, use JDBC to connect to your database and obtain a ResultSet. Iterate over your ResultSet and use either JDBC again, or a straight file output using the Java IO API to generate your CSV file.

Also, I think your name is against the Java Ranch naming policy. You may want to update it before one of the moderators notice. EDIT: Too late.
[ June 02, 2006: Message edited by: Jody Brown ]
17 years ago