[Solved] Creating a class with all of my functions in java


@Quincunx’s answer in the comments is correct, but writing whole programs like this violates all sorts of OO principles, and it’s not a good idea for readability, maintainability, etc. You probably want to go back and read some basic Java tutorials.

For example, to use a method outside of the class that declares it, you need to create an instance of that object:

public class Foo {
   public void doSomething() {
       System.out.println("I did something!");
   }
}

public class Bar {
   public static void main(String[] args) {
       Foo foo = new Foo();
       foo.doSomething();
   }
}

If you have a method that’s not specific to the class that declares it (i.e., a utility class), though, then by all means declare it static:

public class Foo {
   public static void doSomething() {
       System.out.println("I did something!");
   }
}

public class Bar {
   public static void main(String[] args) {
       Foo.doSomething();
   }
}

solved Creating a class with all of my functions in java