fork download
  1.  
  2. import java.io.*;
  3. public class wareki_seireki {
  4.  
  5. public static void main(String args[])
  6. {
  7. int x_nen, y_tuki, z_hi, r_all;
  8.  
  9. System.out.print("input integer: ");
  10.  
  11.  
  12. try{
  13.  
  14. String buf = br.readLine();
  15. String nen = buf.substring(0,4);
  16. String tuki = buf.substring(4,6);
  17. String hi = buf.substring(6,8);
  18. String all = buf.substring(0,8);
  19.  
  20. x_nen = Integer.parseInt(nen);
  21. y_tuki = Integer.parseInt(tuki);
  22. z_hi = Integer.parseInt(hi);
  23. r_all = Integer.parseInt(all);
  24.  
  25. }catch(Exception e){
  26.  
  27. x_nen = 0;
  28. y_tuki=0;
  29. z_hi=0;
  30. r_all = 0;
  31. }
  32.  
  33.  
  34. if(18691023<=r_all && 19120729>=r_all && 01<=y_tuki && 13>y_tuki && 01<=z_hi && 32>z_hi) {
  35. int meiji=x_nen-1868;
  36. System.out.println(("明治")+meiji+("年")+y_tuki+("月")+(++z_hi)+("日"));
  37. }
  38.  
  39. if(19120730<=r_all && 19261224>=r_all && 01<=y_tuki && 13>y_tuki && 01<=z_hi && 32>z_hi) {
  40. int taisyo=x_nen-1911;
  41. System.out.println(("大正")+taisyo+("年")+y_tuki+("月")+z_hi+("日"));
  42. }
  43.  
  44. if(19261225<=r_all && 19890107>=r_all && 01<=y_tuki && 13>y_tuki && 01<=z_hi && 32>z_hi) {
  45. int syowa=x_nen-1925;
  46. System.out.println(("昭和")+syowa+("年")+y_tuki+("月")+z_hi+("日"));
  47. }
  48.  
  49. if(19890108<=r_all && 20121231>=r_all && 01<=y_tuki && 13>y_tuki && 01<=z_hi && 32>z_hi) {
  50. int heisei=x_nen-1988;
  51. System.out.println(("平成")+heisei+("年")+y_tuki+("月")+z_hi+("日"));
  52. }
  53.  
  54.  
  55. }
  56.  
  57. }
  58.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:3: class wareki_seireki is public, should be declared in a file named wareki_seireki.java
public class wareki_seireki {
       ^
1 error
stdout
Standard output is empty