Methods in java are like functions in C++. A method can prompt for and read in variables, calculates variables, display variables, and so on. A method can be used in a class in Java. Here is the code syntax for method in Java.

public class VoltageDivider {
public static double readInResistor(double r1) {
// prompt for and read in a value for a resistor

public static void main(String []args) {
double r1, r2;
r1 = readInResistor(r1);
r2 = readInResistor(r2);