【286天】我爱刷题系列045(2017.11.18)

发布时间:2019-06-13 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了【286天】我爱刷题系列045(2017.11.18)脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

叨叨两句

  1. 果然,能长期坚持一件事的同伴真的很少啊,一个一个的,看着看着,就都坚持不下去了。

  2. 罗胖做的最伟大的一件事,就是把全中国改变意愿最强,最有自驱力的一群人,找了出来,跨年夜,我要和你们在一起!

  3. @H_360_13@

牛客网——java专项练习025

1

下面哪个不是标准Statement类?
正确答案: D

  1. Statement

  2. PReparedstatement

  3. Callablestatement

  4. BatchedStatement

答案:D
Statement在JDBC中相当于SQL语句的载体
A,Statement是最基本的用法,采用字符串拼接的方式,存在注入漏洞
B,PreparedStatement对Statement中的SQL语句进行预编译,同时检查合法性,效率高
C,CallableStatement接口扩展 PreparedStatement,用来调用存储过程,它提供了对输出和输入/输出参数的支持。CallableStatement 接口还具有对 PreparedStatement 接口提供的输入参数的支持。
D,不是标准的Statement类

2

java如何接受request域中的参数?
正确答案: C

  1. request.getRequestURL()

  2. request. getAttribute()

  3. request.getParameter()

  4. request.getWrITer()

request.getAttribute()方法返回request范围内存在的对象,而request.getParameter()方法是获取http提交过来的数据。getAttribute是返回对象,getParameter返回字符串。

3

下列说法正确的是()
正确答案: B 你的答案: B (正确)

  1. 在类方法中可用@L_512_2@来调用本类的类方法

  2. 在类方法中调用本类的类方法时可直接调用

  3. 在类方法中只能调用本类中的类方法

  4. 在类方法中绝对不能调用实例方法

B 类方法是指用static修饰的方法,普通方法叫对象方法。 A.this指的是当前对象,类方法依附于类而不是对象this会编译出错 C.类方法中也可以调用其他类的类方法。同时可以通过创建对象来调用普通方法 D.类方法中可以创建对象,所以可以调用实例方法

4

如下哪些是 java 中有效的关键字()
正确答案: A D

  1. native

  2. NULL

  3. false

  4. this

这个关键字常见的坑:
truefalsenull都不是关键字
goto、const、是保留的关键字
abstract                continue           for            new        
switch                  default            if             package     
synchronized            do                 goto           private     
this                    break              double         implements   
protected               throw              byte           else       
import                  public             throws         case       
enum                    instanceof         return         transient  
catch                   extends            int            short       
try                     char               final          interface    
static                  void               class          finally   
long                    strictfp           volatile       const      
float                   native             suPEr          while
boolean                 assert 
The keywords const and goto are reserved, even though they are not currently used. This may allow a Java compiler to produce better error messages if these C++ keywords incorrectly appear in programs.
While true and false might appear to be keywords, they are technically boolean literals (§3.10.3). Similarly, while null might appear to be a keyword, it is technically the null literal (§3.10.7).
大概意思constgoto是保留关键字。truefalse看起来像关键字,但严格来说,它们是boolean常量;null看起来也像关键字,但严格来说,它是null常量。
综上,true,false,null不是关键字。而是常量。

5

下面选项中,哪些是interface中合法方法定义?()
正确答案: A C D

  1. public void main(String [] args);

  2. private int getSum();

  3. boolean setFlag(Boolean [] test);

  4. public float get(int x);

interface中的方法默认为public abstract 的 ,变量默认为public static final
只是方法名称和参数名称取的比较特殊,java中正确的main方法定义是 public static void main(String[] args){ } B: 接口中不能定义私有方法 C 不显示标明方法的访问修饰符,接口中默认是public D get可以作为方法名称,应该无异议

脚本宝典总结

以上是脚本宝典为你收集整理的【286天】我爱刷题系列045(2017.11.18)全部内容,希望文章能够帮你解决【286天】我爱刷题系列045(2017.11.18)所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。