• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

I have a bug with NeatBeans also in Visual Code, I don't what i'm doing wrong

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The thing goes like this: after choosing the position of your ship, the game starts showing you a grid of gray squares in which you should be able to click on the gray squares and hit or turn the squares white and the top table will show your ships, but the The error only occurs when I have the classes inside packages or I don't know what happens, because when I run the classes together without being in a package and placing a fixed file path, the program works correctly. I'm not quite sure.

Thanks everyone




That's my code
https://drive.google.com/drive/folders/13WHlF4K-5NbF8u5b4OsQ6gcgfxF4iRAc?usp=sharing
image_2023-11-20_222254493.png
[Thumbnail for image_2023-11-20_222254493.png]
image_2023-11-13_200213693.png
[Thumbnail for image_2023-11-13_200213693.png]
 
Saloon Keeper
Posts: 235
7
Android Python Oracle Postgres Database Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's quite hard to say what happened when you don't include the error message(s) you got  when running the code with explicit package declarations.

It's hard to guess what went wrong - especially when the link in Google Drive is not readable. When you have an error related to  package definition it may be that the source code is not placed into directories according to the package name.

Here I am using plain javac and java - in real life a build tool such as Maven should be used, but that's another story.

Code for class A in package com.example should the be put into the directory :



Then you can compile:


... and execute the class:



 
Marshal
Posts: 80282
432
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Juan Hidalgo wrote:. . .. . .

Just like RM, I am unable to compile your code because some is missing. I can see some errors however. For example, the above is not a default constructor. I don't know whether it is a good idea to overload the constructor name like that.
I think you are wrong to use an Object[][] and cast its elements when you could use a ShipPiece[][] instead. It is also a bad idea to pass a reference to an array without taking a defensive copy.
I don't think the boolean called isTurn is the correct way to handle alternating players. And why is it volatile?
 
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic