Write a java program that declares and displays a named constant that holds the number of seconds in a minute and a variable to represent the number of your subject. Name the class as DataStore and save the file. Debug syntax and logical errors if there any in the program.
class DataStore {
private final int numberSecondsMinute = 60;// the number of seconds in a minute
private int numbeSubject;// a variable to represent the number of your subject.
public DataStore(int numbeSubject) {
this.numbeSubject = numbeSubject;
}
/**
* @return the numberSecondsMinute
*/
public int getNumberSecondsMinute() {
return numberSecondsMinute;
}
/**
* @return the numbeSubject
*/
public int getNumbeSubject() {
return numbeSubject;
}
/**
* @param numbeSubject the numbeSubject to set
*/
public void setNumbeSubject(int numbeSubject) {
this.numbeSubject = numbeSubject;
}
}
public class App {
/**
* The start point of the program
*
* @param args
*
*/
public static void main(String[] args) {
DataStore dataStore =new DataStore(5);
System.out.println("The number of seconds in a minute: "+dataStore.getNumberSecondsMinute());
System.out.println("The number of your subject: "+dataStore.getNumbeSubject());
}
}
Comments
Leave a comment