A、try catch finally
B、try
C、try catch
D、try finally
第2题
A. try后面是可能产生异常的代码,catch后面是捕获到某种异常对象时进行处理的代码,final后面是没有捕获到异常时要执行的代码
B. try后面是可能产生异常的代码,catch后面是捕获到某种异常对象时进行处理的代码,final后面是无论是否捕获到异常都必须执行的代码
C. catch语句和final语句都可以缺省
D. catch语句用来处理程序运行时的非致命性错误,而final语句用来处理程序运行时的致命性错误
E. 当程序运行时抛出的异常是cathe语句中异常的子类,异常也会被捕捉执行相应的catch语句
第4题
A、放在类定义中类名后面,表示该类不能被继承
B、放在虚函数后面,表示该虚函数不可被覆写
C、放在任意函数后面,表示该函数不可被重载
D、放在对象定义的前面,表示该对象是不可变对象
E、放在catch块后面,表示不管是否捕获try块中的异常,都执行final块的代码
第6题
A.Labelj1 = new JLabel(str + "0");
B.final JLabel j1 = new JLabel(str + "0");
C.final JLabelj1 = JLabel(str + "0");
D.JLabelj1 = new JLabel(str + "0");
第7题
It was early one morning in February 1972 when Mayoral and his partner Santos Luis Perez set out to fish in Laguna San Ignacio. Hundreds of gray whales were swimming in the three-mile-long, one-mile-wide inlet. This was usual between December and April, for the whales breed in the protected inlets of Baja, the final destination of their annual 6,000-mile migration from the Arctic. Mayoral and Perez stayed as for as possible from the spouting (喷涌) creatures, because the whales were said to smash boats with their powerful flukes (鲸尾的叶). Mayoral, who had 16 years' experience at sea, knew no one who had been close to a healthy gray whale and lived.
As Mayoral rowed to catch the outgoing (退出去的) tide, he saw, straight ahead, a whale approaching. Heart pounding, the 31-year-old turned the little wooden boat and pulled hard for shore. Try as he might, however, he could not row over the huge beast. In moments, it overtook them. Expecting the worst, the fishermen dropped to their knees and made the sign of the cross. The whale raised its nine-foot head out of the water and looked at them. Then, remarkably, it began to rub gently against the boat.
Sinking and resurfacing (重新露出水面) on opposite sides of the boat, the whale continued its gentle rubbing for almost an hour. At first the men prayed, frozen in fear. But gradually Mayoral's terror gave way to curiosity. He was tempted to reach out and touch this oddly unthreatening monster, but a lifetime of caution kept him still.
At last, having finished with whatever its purpose had been, the whale disappeared below the surface. Some time passed before either man spoke. Then they headed home. To his wife, Mayoral said only, "No fish today."
But word spread through the cluster of small wooden houses near the salt-water lake. A strange thing had happened: one of the whales had tried to touch the men, and the men had returned unharmed. Why?
In nights to come, by faint kerosene lamps, Mayoral and Perez told the story. They and other fishermen struggled to understand. What did the whale want?
We know from the passage that the whales traveled 6,000 miles from the Arctic to the inlets of Baja ______.
A.just to have a change in environment
B.to give birth to baby whales in winter
C.to escape from the cold water for a while
D.to find a warm place to settle down
第8题
It was early one morning in February 1972 when Mayoral and his partner Santos Luis Perez set out to fish in Laguna San lgnacio. Hundreds of gray whales were swimming in the three-mile-long, one-mile-wide inlet. This was usual between December and April, for the whales breed in the protected inlets of Baja, the final destination of their annual 6,000-mile migration from the Arctic. Mayoral and Perez stayed as for as possible from the spouting (喷涌) creatures, because the whales were said to smash boats with their powerful flukes (鲸尾的叶). Mayoral, who had 16 years' experience at sea, knew no one who had been close to a healthy gray whale and lived.
As Mayoral rowed to catch the outgoing (退出去的) tide, he saw, straight ahead, a whale approaching. Heart pounding, the 31-year-old turned the little wooden boat and pulled hard for shore. Try as he might, however, he could not row over the huge beast. In moments, it overtook them. Expecting the worst, the fishermen dropped to their knees and made the sign of the cross. The whale raised its nine-foot head out of the water and looked at them. Then, remarkably, it began to rub gently against the boat.
Sinking and resurfacing(重新露出水面) on opposite sides of the boat, the whale continued its gentle rubbing for almost an hour. At first the men prayed, frozen in fear. But gradually Mayoral 's terror gave way to curiosity. He was tempted to reach out and touch this oddly unthreatening monster, but a lifetime of caution kept him still.
At last, having finished with whatever its purpose had been, the whale disappeared below the surface. Some time passed before either man spoke. Then they headed home. To his wife, Mayoral said only, "No fish today."
But word spread through the cluster of small wooden houses near the salt-water lake. A strange thing had happened: one of the whales had tried to touch the men, and the men had returned unharmed. Why?
In nights to come, by faint kerosene lamps, Mayoral and Perez told the story. They and other fishermen struggled to understand. What did the whale want?
We know from the passage that the whales traveled 6,000 miles from the Arctic to the inlets of Baja ______.
A.just to have a change in environment
B.to give birth to baby whales in winter
C.to escape from the cold water for a while
D.to find a warm place to settle down
第9题
A.InetAddress ia = URL.getByName(strName);
B.InetAddress ia = InetAddress.getByName(strName);
C.InetAddress ia = new InetAddress.getByName(strName);
D.InetAddress ia = InetAddress.getByName(ur1);
第10题
下面的程序可以下载多个网页文件(download方法已写好),请将它改成多线程进行下载,如果可能, 显示计算全部下载完成程序所用的时间(提示:new Date().getTime()可以得到当前时间的毫秒数)。 import java.net.URL; import java.io.*; class Downloader { public static void main(String[] args) throws Exception { final URL[] urls = { new URL("http://www.pku.edu.cn"), new URL("http://www.baidu.com"), new URL("http://www.sina.com.cn"), new URL("http://www.dstang.com") }; final String[] files = { "pku.htm", "baidu.htm", "sina.htm", "study.htm", }; for(int idx=0; idx<urls.length; idx++){ try{ system.out.println( urls[idx] ); download( urls[idx], files[idx]); }catch(exception ex){ ex.printstacktrace(); } static void url url, string file) throws ioexception { try(inputstream input="url.openStream();" outputstream output="new" fileoutputstream(file)) byte[] data="new" byte[1024]; int length; while((length="input.read(data))!=-1){" output.write(data,0,length);>
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!