Sonntag, 20. November 2022

HIU プログラム言語I 3/13

キーボード入力が職業訓練で習っているのとだいぶ違う。


大学のビデオ講座は内容が古いんだよな。とは言え試験はこの古い内容で出るからしっかり覚えないと。


import jaca.io.*;


class Rensyu

public static void main(String[] args){

throws IOException {

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));


int year,month

System.out.println(“あなたの生まれた年を教えてください”);

year = Integer.parseInt(br.readLine());


System.out.println(“あなたの生まれた月を教えてください”);

month = Integer.parseInt(br.readLine());


System.out.println(“あなたは” + year+ “年” + month” + 月うまれですね)”;

System.out.println();


職業訓練で習ったコード


import java.util.Scanner;


puclic class Rensyu{

public static void main(String[] args){

Scanner in = new Scanner(System.in);

System.out.println(“あなたの生まれた年を教えてください”);

int year = in.nextInt();

System.out.println(“あなたは” + year + “年生まれですね”);


in.close();


全然違う。。。

Keine Kommentare:

Kommentar veröffentlichen

Hinweis: Nur ein Mitglied dieses Blogs kann Kommentare posten.