第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

麻煩大神幫我指點一下一下這段代碼該怎么改?謝謝

父類:

package com.imocc

public abstract class shape {

public abstract void l();

public abstract void s();

}

子類:rectangle

package com.imocc;

public class rectangle extends shape {

public void l(int a,int b){

System.out.println("長方形的周長是:"+(a+b)*2);

}

public void s(int a,int b){

System.out.println("長方形的面積是:"+a*b);

}

}

子類circle:

package com.imocc;

public class circle extends shape {

double π=3.14;

public void l(int r){

double m=2*π*r;

System.out.println("圓形的周長是:"+m);

}

? ? public void s(int r){

? ? double n=π*r*r;

? ? System.out.println("圓形的面積是:"+n);

? ? }

}

inital;

package com.imocc;

import java.util.Scanner;

public class inital {

public static void main(String[] args) {

shape rec=new rectangle();

Scanner input=new Scanner(System.in);

System.out.println("請輸入長方形的長a:");

int a=input.nextInt();

System.out.println("請輸入長方形的寬b:");

int b=input.nextInt();

rec.l(a,b);

rec.s(a,b);

shape c=new circle();

Scanner input2=new Scanner(System.in);

System.out.println("請輸入圓形的半徑r:");

int r=input2.nextInt();

c.l(r);

c.s(r);

// TODO Auto-generated method stub

}

}


正在回答

1 回答

Java抽象類中的抽象方法的參數(shù)對應(yīng)的子類的方法的參數(shù)必須一致

1 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

麻煩大神幫我指點一下一下這段代碼該怎么改?謝謝

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號