类是一个模板,它描述一类对象的行为和状态
1.Which of the following reserved words in Java is used to create an instance of a class?
A .class
B .public
C .public or private, either could be used
D .import
E .new
解析:new用来创建类的实例,如Car x=new Car()。
***
2.A variable whose scope is restricted to the method where it was declared is known as a(n)
A .parameter
B .global variable
C .local variable
D .public instance data
E .private instance data
解析:本地变量在声明之后,只有在声明的方法里面才可以被引用。
***
A .length
B .substring
C .equals
D .toUpperCase
E .none of the above, it is not possible to pass a String as a parameter in a message to a String
解析:在equals中必须使用parameter参数
***
4.The expressions that are passed to a method in an invocation are called
A .actual parameters
B .formal parameters
C .formal arguments
D .formals
E .any of the above
解析:实际的参数(实际参数、实际参数)是实际在调用中传输到方法的表达式
***
5.What happens if you declare a class constructor to have a void return type?
A .You‘ll likely receive a syntax error
B .The program will compile with a warning, but you‘ll get a runtime error
C .There‘s nothing wrong with declaring a constructor to be void
D .The class‘ default constructor will be used instead of the one you‘re declaring
E .None of the above
解析:每一个函数里都有构造函数,如果自己加了void类型后也只会是出现一个空的构造函数而非产生语法错误。
***
6.The following method header definition will result in a syntax error: public void aMethod( );
A .true
B .false
解析:语法错误的原因是因为它以“;”符号结尾后面没有跟着{}
***
7.Defining formal parameters requires including each parameters type.
A .true
B .false
解析:所有的正式参数 (在方法头中定义的) 必须包括它们的类型
***
正确使用Markdown语法(加1分):
不使用Markdown不加分
有语法错误的不加分(链接打不开,表格不对,列表不正确...)
排版混乱的不加分
教材学习中的问题和解决过程, 一个问题加1分
代码调试中的问题和解决过程, 一个问题加1分
本周主要学习了面向对象的内容,包括类的继承和方法的使用等内容,感觉难度越来越大,一定尽力跟上大家的进度,不被超越太多
代码行数(新增/累积) | 博客量(新增/累积) | 学习时间(新增/累积) | 重要成长 | |
---|---|---|---|---|
目标 | 5000行 | 30篇 | 400小时 | |
第一周 | 126/126 | 2/2 | 20/20 | |
第二周 | 0/126 | 2/2 | 20/40 | |
第三周 | 353/479 | 2/6 | 20/60 | |
第四周 | 1760/2239 | 2/8 | 30/90 |
学号 2019-2020-1 《数据结构与面向对象程序设计》第四周学习总结
原文:https://www.cnblogs.com/pytznb/p/11614467.html