Quantcast
Channel: 質問!ITmedia 新着質問(Java/253)
Viewing all articles
Browse latest Browse all 2439

Javaのオーバーロードを使った問題

$
0
0
class Book{ String title, size; int price; Book(String title, String size, int price){ this.title = title; this.size = size; this.price = price; } public String info(){ return title + " " + size; } public String info(String title){ return title + " " + size + " " + price +"円"; } public int info(String title, String size){ return price; } } ________________________________________________________ class Book_test{ public static void main(String[] args){ String[] title = {"図鑑","参考書","雑誌","地図"}; String[] size = {"B4", "A5", "A4", "A3"}; int[] price={4500, 1800, 600, 1400}; Book[] b = new Book[4]; for(int i=0; i

Viewing all articles
Browse latest Browse all 2439

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>