发布于2021-06-12 14:55 阅读(325) 评论(0) 点赞(4) 收藏(2)
文章目录:
- ×(不能,但是可以通过super()调用,方法是没有继承一说的,只有覆写或者重载,类和类之间才能叫继承)
- √(构造函数为何不能用abstract, static, final修饰)
- ×
- √
- ×
- √
- √
- √
- ×(abstract类中可以有非abstract方法,但“该方法”不可以用final修饰)
- ×
为什么类和接口不能使用private和protected?接口的方法不能使用private、protected、default
- (1)D
- (2)A
- (3)B
- (4)C
- (5)D
- (6)A
- (1)B
- (2)D
- (3)C
- (4)D
- (1)22
- (2)6:6:100
- (3)18:18
- (4)18:12:7:6
- 1.
- public class A
- {
- final void f()
- {
- char yingwen;
- int count=0;
- System.out.println("英文字母表:");
- for (int i = 65;i<=90;i++)
- {
- yingwen=(char)i;
- System.out.print(yingwen+"\t");
- count++;
- if (count%5==0)
- {
- System.out.println();
-
- }
-
- }
-
- }
- }
-
-
-
- public class B extends A
- {
- void g()
- {
- char xina;
- int count=0;
- System.out.println("希腊字母表:");
- for (int i=913;i<=937;i++)
- {
- xina=(char)i;
- System.out.print(xina+"\t");
- count++;
- if (count%5==0)
- {
- System.out.println();
-
- }
-
- }
- }
- }
-
-
-
- public class Liu
- {
- public static void main(String[] args)
- {
- B b = new B();
- b.f();
- System.out.println();
- b.g();
- }
- }
- 2.
- public class Max
- {
- public int f(int a,int b)
- {
- int min,result = 0;
- if(a > b)
- {
- min = b;
-
- }
- Else
- {
- min = a;
- }
- for(int i = 1; i <= min; i++)
- {
- if(a % i == 0 && b % i == 0){
- result = i;
- }
- }
- return result;
- }
- }
-
- public class Min extends Max
- {
- public int f(int a,int b)
- {
- int m = super.f(a, b);
- return (a*b)/m;
- }
- }
-
-
-
- public class Liu
- {
- public static void main(String[] args)
- {
- Max a = new Max();
- System.out.println(a.f(13,52);
- a = new Min();
- System.out.println(a.f(13,52));
- }
- }
原文链接:https://blog.csdn.net/liu17234050/article/details/117676591
作者:我爱编程
链接:http://www.javaheidong.com/blog/article/222568/3d19b75e84296d4c1b80/
来源:java黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 java黑洞网 All Rights Reserved 版权所有,并保留所有权利。京ICP备18063182号-2
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!