Every IDE has its own models and assumptions, and you need to understand these before you will be able to make much progress.
Although Eclipse looks like a kind of fancy text editor, it is really designed so you can work on multiple projects at once. All code in Eclipse needs to be in a "project". This can easily confuse you if you just want to get started with some great code you have seen here at the Ranch!
The first thing to do is to select
File -> New -> Java Project.
Give your project a name in the top field, then click "
Finish" at the bottom.
A box will pop up asking about modules. Unless you are very experienced with modules, I strongly recommend clicking "
Don't Create"
This will create a new project with the minimum structure in the current "workspace". For a first project you don't really need to worry about workspaces, just know that a workspace is a folder somewhere in your home folder and probably named something like "eclipse_workspace".
Once you have a project, it should appear in the "Package Explorer" at the left of the Eclipse window. Click the little triangle to show its contents if they are not already visible.
Java classes should (almost) always be in a package, and Eclipse prefers you to create a package first, so you have somewhere to put your code.
Right-click on the source folder and select
New -> Package.
Give your package a name, such as
example ancd click
Finish. Note that the package name starts with a small letter.
Once you have created a package it will also appear in the project. Finally, you are in a position to create a Java class.
Right-click your new package and select
New -> Class.
Give the class a name, such as
Example, and click
Finish. Note that a class name should always start with a capital letter.
You should now have a project with a Java class in a package, ready for you to type your code an run it.
I hope that helps