This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin Cookbook and have Ken Kousen on-line!
See this thread for details.
Win a copy of Kotlin Cookbook this week in the Kotlin forum!

Mike Lomman

Greenhorn
+ Follow
since Dec 26, 2019
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
1
Given in last 30 days
1
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Lomman

Carey,
              don't the following lines
2 weeks ago

Carey Brown wrote:
When I tried to compile your code I get lots of compiler errors, the first one being the right-angle-bracket on line 21. I don't get an error on line 30 though. The creation of a new ParkingSpace in main() is totally wrong though.

I suspect your code listing is not in sync with your error message(s). I would suggest fixing as many of the other errors as you can and if you are still stuck, repost a current copy of the code with a complete cunt-and-paste of ALL of the error messages.





The only error I had was the instantiation error.
The angle bracket somehow was inserted during my post, it isn't in my original code.

Since the error vanished and I guess it was how/where the class was saved that caused it I have been unable to continue as I can no longer see a path forward.
My erroneous assumption was that the code at line 18 would fill the array with values.
However I try to print those values does not work.

I am going fishing.

I am out of ideas.
3 weeks ago
Thank you all for your helpful comments.

Yes there are other errors in my code.

The instantiation error has gone.

My guess is the way the classes were saved caused the issue, as I resaved them both and the error as I said is gone.

Thank you to the JAVA Gods, and you lovely people for your assistance.

I have copied your comments about better code writing so I can learn them.

Many thanks

Mike
4 weeks ago
Many Thanks for your rapid response.  shall read them carefully and take on board your valuable tips.

As far as naming the methods, in this particular instance the names have been provided, but I see your point  is useful in general

I used the overloaded constructor in ParkingSpace to see whether it solved my issue, it didn't and I forgot to remove it.

I will read through the links you have provided and continue my search.

Again many thanks for your response.

Mike
1 month ago
I am new to Java. I use the eclipse to write the code and test it.

I have searched endlessly it seems for a solution to my issue.
I have also contacted the school for support but they are often tardy with their response(well they have been in the past).

I am creating two classes, and have an error 'cannot instantiate the type' and don't know why nor how to fix it.


The first class ParkingSpace




The second class ParkingLot





Line 27 in the  ParkingLot class gives me the "cannot instantiate the ParkingSpace type" error.

I imagine that this error is causing a few other errors further along in the code. And I have yet to complete other parts of the code.

Any assistance on this error is appreciated.


Many thanks

Mike
1 month ago