fork download
  1. package topica.moduel;
  2.  
  3. import java.io.Serializable;
  4. import java.util.Scanner;
  5.  
  6. public class Time implements Serializable {
  7.  
  8.  
  9. /**
  10. *
  11. */
  12. private static final long serialVersionUID = 1L;
  13. int day,month , years;
  14. static Scanner sc= new Scanner(System.in);
  15. public Time() {
  16. // TODO Auto-generated constructor stub
  17. }
  18.  
  19. public Time(int day, int month, int years) {
  20. super();
  21. this.day = day;
  22. this.month = month;
  23. this.years = years;
  24. }
  25.  
  26. public int getDay() {
  27. return day;
  28. }
  29.  
  30. public void setDay(int day) {
  31. this.day = day;
  32. }
  33.  
  34. public int getMonth() {
  35. return month;
  36. }
  37.  
  38. public void setMonth(int month) {
  39. this.month = month;
  40. }
  41.  
  42. public int getYears() {
  43. return years;
  44. }
  45.  
  46. public void setYears(int years) {
  47. this.years = years;
  48. }
  49.  
  50. public void inputDay() throws ExceptionValue
  51. {
  52. System.out.print("Nhập ngày sinh : ");
  53. this.day = Integer.parseInt(sc.nextLine());
  54. if(this.day<0||this.day>31)
  55. throw new ExceptionValue();
  56. }
  57. public void inputMonth() throws ExceptionValue
  58. {
  59. System.out.print("Nhập tháng sinh : ");
  60. this.month = Integer.parseInt(sc.nextLine());
  61.  
  62. if(this.month<1||this.month>12)
  63. throw new ExceptionValue();
  64.  
  65. }
  66. public void inputYears() throws ExceptionValue
  67. {
  68. System.out.print("Nhập năm sinh : ");
  69. this.years = Integer.parseInt(sc.nextLine());
  70. if(this.years<1900||this.years>2018)
  71. throw new ExceptionValue();
  72. }
  73.  
  74. public static int compare(Time t1 , Time t2)
  75. {
  76. int value = t1.years-t2.years;
  77. if(value!=0)
  78. {
  79. return value;
  80. }
  81. value = t1.month - t2.month;
  82. if(value!=0)
  83. {
  84. return value;
  85. }
  86.  
  87. value = t1.day - t2.day;
  88. return value;
  89. }
  90.  
  91.  
  92.  
  93.  
  94.  
  95. }
  96.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:6: error: class Time is public, should be declared in a file named Time.java
public class Time implements Serializable {
       ^
Main.java:50: error: cannot find symbol
	public void inputDay() throws ExceptionValue
	                              ^
  symbol:   class ExceptionValue
  location: class Time
Main.java:57: error: cannot find symbol
	public void inputMonth() throws ExceptionValue
	                                ^
  symbol:   class ExceptionValue
  location: class Time
Main.java:66: error: cannot find symbol
	public void inputYears() throws ExceptionValue
	                                ^
  symbol:   class ExceptionValue
  location: class Time
Main.java:55: error: cannot find symbol
    		throw new ExceptionValue();
    		          ^
  symbol:   class ExceptionValue
  location: class Time
Main.java:63: error: cannot find symbol
    		throw new ExceptionValue();
    		          ^
  symbol:   class ExceptionValue
  location: class Time
Main.java:71: error: cannot find symbol
    		throw new ExceptionValue();
    		          ^
  symbol:   class ExceptionValue
  location: class Time
7 errors
stdout
Standard output is empty