How to import stuff in java with Visual Studio Code

Hazel :

Im new with Java and i'm struggling with packages and classes when it comes to imports. So i want to do something simple :

I want to include my class that takes inputs from the user, but somehow it keeps giving me all sorts of errors.

enter image description here

SecondThread :

In Java, to be part of a package, you both need to be inside the correct folder, and start the file with package myclass;. You didn't show us the source code for Clavier.java but my educated guess is that you didn't start it with package myclass;.

As a side note, myclass is a really bad and confusing name for a package (which isn't a class).

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=238429&siteId=1