This is a program which computes the circumference of two circles and gives some information such as the difference between circumferences.  I want to know whether the method declarations and method calling in my code is correct.  I didn't face any errors.import java.text.*;import javax.swing.*;class Q5Main{    public static void main(String args[]){        double smallCircum;        double largeCircum;        InputHandler input = new InputHandler();        Question5 myq = new Question5();        double a = input.getDouble(Radius for the smaller circle:);        smallCircum = (myq.start(a));//calculate the small circle circumference        a = input.getDouble(Radius for the larger circle: );        largeCircum = (myq.start(a));//calculate the large circle circumference        myq.showDetails(smallCircum, largeCircum);    }}class Question5{    DecimalFormat df = new DecimalFormat(0.000);    private double circumference;//to store circumference    //carry out the full process    public double start(double value){        return circum(value);    }    //compute the circumference    private double circum(double radius){        circumference = 2 * Math.PI * radius;        return circumference;    }    public void showDetails(double smallCircum, double largeCircum){        System.out.println(Circumference of smaller circle: +df.format(smallCircum));        System.out.println(\n);        System.out.println(Circumference of larger circle: +df.format(largeCircum));        System.out.println(\n);        System.out.println(Difference: +df.format((largeCircum-smallCircum)));    }}class InputHandler{    private static final String DOUBLE_DEFAULT_PROMPT = Enter integer: ;    public double getDouble(){        return getDouble(DOUBLE_DEFAULT_PROMPT);    }    public static double getDouble(String prompt){        String inStr;        inStr = JOptionPane.showInputDialog(null,prompt);        return Double.parseDouble(inStr);    }}
Computing the circumference of two circles
java
Although your code works, it's not so good.Declare variables as late as possibleHere you declare some variables at the top, and use them much later, for example smallCircum:double smallCircum;double largeCircum;InputHandler input = new InputHandler();Question5 myq = new Question5();double a = input.getDouble(Radius for the smaller circle:);smallCircum = (myq.start(a));//calculate the small circle circumferenceIt would be better to declare as late as possible, right before you need it:InputHandler input = new InputHandler();Question5 myq = new Question5();double a = input.getDouble(Radius for the smaller circle:);double smallCircum = (myq.start(a));//calculate the small circle circumferencePointless fieldIn Question5, the variable circumference doesn't need to be a field.It's only used here:private double circum(double radius){    circumference = 2 * Math.PI * radius;    return circumference;}But there is no need to store that value in a field, and no need for even a local variable, you can simply return it directly:private double circum(double radius) {    return 2 * Math.PI * radius;}static methodIt's unclear why this method in InputHandler is static:public static double getDouble(String prompt){I suggest to drop the static keyword, make it non-static.Poor namingLooking at this:smallCircum = (myq.start(a));//calculate the small circle circumferenceA method named start returns the calculated circumference.That's really not intuitive.Why not rename start to calculateCircum?If its containing Question5 class needs to be kept general purpose and not imply circumference, then perhaps you can rename the method to just calculate instead.Probably almost anything is better than start.Another thing, a is a poor name to store radius.Make private what you canIn Question5, df should be private.Make final what you canIn Question5, df can be final.Suggested implementationWith the above suggestions applied, the solution becomes:package com.janosgyerik.practice.oj.leetcode.hard.SubstringWithConcatenationOfAllWords;class Q5Main {    public static void main(String args[]) {        InputHandler input = new InputHandler();        Question5 myq = new Question5();        double smallRadius = input.getDouble(Radius for the smaller circle:);        double smallCircum = myq.calculate(smallRadius);        double largeRadius = input.getDouble(Radius for the larger circle: );        double largeCircum = myq.calculate(largeRadius);        myq.showDetails(smallCircum, largeCircum);    }}    class Question5 {    private final DecimalFormat df = new DecimalFormat(0.000);    public double calculate(double value) {        return circum(value);    }    private double circum(double radius) {        return 2 * Math.PI * radius;    }    public void showDetails(double smallCircum, double largeCircum) {        System.out.println(Circumference of smaller circle:  + df.format(smallCircum));        System.out.println(\n);        System.out.println(Circumference of larger circle:  + df.format(largeCircum));        System.out.println(\n);        System.out.println(Difference:  + df.format((largeCircum - smallCircum)));    }}    class InputHandler {    private static final String DOUBLE_DEFAULT_PROMPT = Enter integer: ;    public double getDouble() {        return getDouble(DOUBLE_DEFAULT_PROMPT);    }    public double getDouble(String prompt) {        String inStr = JOptionPane.showInputDialog(null, prompt);        return Double.parseDouble(inStr);    }}