·¢²¼Ê±¼ä : ÐÇÆÚÈÕ ÎÄÕÂjavaÁ·Ï°Ì⼯´ð°¸½âÎö¸üÐÂÍê±Ï¿ªÊ¼ÔĶÁ098bc5c62f3f5727a5e9856a561252d381eb2019
}
10.дһ¸öÀ࣬¸ÃÀàÓÐÒ»¸ö·½·¨public int f(int a,int b),¸Ã·½·¨·µ»ØaºÍbµÄ×î´ó¹«Ô¼Êý¡£È»ºóÔÙ±àдһ¸ö¸ÃÀàµÄ×ÓÀ࣬ҪÇó×ÓÀàÖØд·½·¨f£¬¶øÇÒÖØдµÄ·½·¨½«·µ»ØaºÍbµÄ×îС¹«±¶Êý£»ÒªÇóÔÚÖØдµÄ·½·¨ÌåÖÐÊ×Ïȵ÷Óñ»Òþ²ØµÄ·½·¨·µ»ØaºÍbµÄ×î´ó¹«Ô¼Êým£¬È»ºó½«³Ë»ý£¨a*b£©/m·µ»Ø£»ÒªÇóÔÚÓ¦ÓõijÌÐòµÄÖ÷ÀàÖзֱðʹÓø¸ÀàºÍ×ÓÀà´´½¨¶ÔÏ󣬲¢·Ö±ðµ÷Ó÷½·¨f¼ÆËãÁ½¸öÕýÕûÊýµÄ×î´ó¹«Ô¼ÊýºÍ×îС¹«±¶Êý¡£
class A {
public int f(int a, int b) {
if (b < a) {
int temp = 0; temp = a; a = b; b = temp; }
int r = b % a; while (r != 0) { }
b = a; a = r; r = b % a;
}
return a; }
class B extends A { }
public class Xiti9 { }
public static void main(String args[]) {
A a = new A(); B b = new B();
System.out.println(\×î´ó¹«Ô¼Êý £º\System.out.println(\×îС¹«±¶Êý £º\}
public int f(int a, int b) { }
int division = super.f(a, b); return (a * b) / division;
µÚ6ÕÂÄÚ²¿ÀàÓëÒì³£ÀàÁ·Ï°Ìâ
Ò»¡¢Ìî¿ÕÌâ
1¡¢ThrowableÀàÓÐÁ½¸ö×ÓÀ࣬·Ö±ðÊÇErrorºÍException.
2¡¢ËùÓÐÒì³£µÄ¸ùÀàÊÇThrowableÀ࣬throw¹Ø¼ü×ÖµÄ×÷ÓÃÊÇÒý·¢Òì³£¡£ 3¡¢try¹Ø¼ü×Ö¸ºÔð¶¨Òå´¦ÀíÒì³£µÄ³ÌÐò£¬ÔÙÀ´ÓÉcatch¹Ø¼ü×ÖÀ´²¶»ñÒì³£¡£ 4¡¢²¹×ã´úÂ룻µ÷ÓÃÁ½¸öº¯Êý£¬ÒªÇóÓÃÄäÃûÄÚ²¿Àà
interface Inter {
void show(int a,int b); void func(); }
class Demo {
public static void main(String[] args) {
Inter in=new Inter(){
Void show(int a,int b){} Void func(){}};
}
in.show(4,5); in.func(); }
5.¡¢ÏÂÃæ³ÌÐòµÄÊä³ö½á¹ûÊÇ£ºBCD
class Demo {
public static void func() throws Exception { }
public static void main(String[] args){
try{ try{
throw new Exception();
} finally{
System.out.println(\); }
func();
System.out.println(\); }