my dog learned polymorphism
The moose likes Beginning Java and the fly likes Object creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Object creation" Watch "Object creation" New topic

Object creation

Mary Taylor
Ranch Hand

Joined: Sep 11, 2000
Posts: 327
I have an Object which consists of a Date and a Vector. I'm glad this is a Beginner Forum because I'm sure what I'm missing is simple. Here is some code:
newObject (Date myDate, Vector my Vector);
public void createNewObject(Vector inVector){
Date newDate = new Date();
newObject myObject = new newObject(newDate, inVector);
The message I get is that the compiler cannot resolve the symbol "new" in the creation of newObject. Suggestions?
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
Could you post all of your code, not just this fragment? In particular, show us the "newObject" class.

Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Wilfried LAURENT
Ranch Hand

Joined: Jul 13, 2001
Posts: 269
...and the exact compiler error message.
Mary Taylor
Ranch Hand

Joined: Sep 11, 2000
Posts: 327
I was working with my code and someone else's together and didn't notice they were using the default constructor, and those fields were data members and not parameters. Sorry, guys. Thanks.
I agree. Here's the link:
subject: Object creation
It's not a secret anymore!