Java Snippets

Hamburger icon

Java Snippets

View the repo

VERY BASIC snippets of code that I find myself using all the time. Maybe they are useful for you too? Who knows. They are here for personal reference.

Each snippet is inside a folder and has a main program. Sometimes there are other classes too.

The Commons folder contains common methods used by all the snippets. They are defined as static inside a final "Commons" class. Then they are called as Commons.method(). The class must be imported wherever we want to use a Commons method, as import commons.Commons.

For example, the class readDouble is used to read a double introduced by keyboard. If the user enters text, it prompts him/her to write a number until a real number is entered.