动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > Java教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ Java教程 ]的信息

本月文章推荐
.jive中的abstractFactory.
.一些非常有用的JAVA常用方法(1).
.揭开 Java 安全标准的神秘面纱.
.扩展Eclipse的Java开发工具(三).
.怎样学习java个人经验.
.Java数据库字符国际化.
.利用视图链接使Eclipse应用程序更.
.Java嵌入式开发之四.
.如何学习Java呢.
.为什么不能把这个斜线省略掉呢?.
.用Java创建带图像的菜单来美化界.
.Java的多线程-线程间的通信(1).
.巧用GC.
.在基于MIDP的应用程序上使用JDBC.
.Displaytag1.1版发布了.
.EJB 3.0开发指南之消息驱动Bean.
.TOMCAT3.1的安装与配置简要介绍.
.Java语言的Socket类.
.Java语言深入:对 java.lang 的研.
.java线程编程(一):线程基础.

非常不错的SCJP真题回忆

发表日期:2008-1-5 |



  PART 1
  
  1.public static void main(String args[]) {
  Boolean a[]=new Boolean[4];
  int I= 1;
  System.out.println(a[I]); }
  What will be printed?
  Compilation Error in Line 2
  Compilation Error in line 4
  Exception in Line 4
  Will print true
  Will print false
  Will print null
  
  Ans:F
  2.
  public static void main(String args[]) {
  Integer b= new Integer(10);
  Add(b);
  System.out.println(b.intvalue());
  }
  void Add(Integer b)
  {
  int I= b.intvalue();
  I+=3;
  b= new Integer(I)
  }
  
  What will be printed out?
  
  Will print 13
  Will print 10
  Compilation Error in Line 4 ?. implicit conversion to Integer to
  String is not possible
  Compilation Error in line 10 you can't re initialize a Wrapper
  class
  Exception in Line 10
  Ans:b
  
  class text{
  public static void main(String args[])
  {
  String a =args[1];
  String b =args[2];
  String c =args[3];
  }
  }
  if you will execute Java text cat dog sheep what will be the value of
  the 'c' ?
  cat
  dog
  sheep
  Compilation Error
  Exception will occur
  Ans:E
  
  4. public static void main(String args[])
  {
  Float f=new Float(4.2f);
  Float c;
  Double d=new Double(4.2);
  float fl=4.2f;
  c=f;
  }
  which will return true?. Select all
  f.equls(d)
  c==f
  c==d
  c.equls(f)
  
  Ans:B,D
  
  5. public static void main(String args[])
  {
  String s;
  System.out.println("s = "+s);
  }
  what will be printed out?
  Compilation Error
  An Exception will occur
  Will print s= null
  Will print s=
  
  Ans:A
  6. class s extends Thread{int j=0;
  public void run() {
  try{Thread.sleep(5000);}
  catch(Exception e){}
  
  j=100;
  }
  public static void main(String args[])
  {
  s t1=new s();
  t1.start();
  System.out.println(t1.j);
  }
  }
  
  what you have to do to ensure that 'j' will print 100
  
  you have make t1 as Daemon Thread
  You have join the t1 to main
  You have to suspend the main when the thread starts and resume it after
  the value of 'j' is set to 100
  You have to interrupt the main thread
  
  Ans:B
  7. What will happen if you compile/run this code?
  
  1: public class Q1 implements Runnable
  2: {
  3: public void run(String s)
  4: {
  5: System.out.println("Before start Thread :"+s);
  6:
  7: System.out.println("After stop of Thread :"+s);
  8: }
  9:
  10: public static void main(String[] args)
  11: {
  12: Q1 a = new Q1();
  13: Thread t=new Thread(a);
  14: t.start();}
  15: }
  
  A) Compilation error at line 1
  B) Runtime exception at line 13.
  C) Compilation error at line 14
  D) Prints "Before start of Thread "
  After Start of Thread
  
  Ans:A
  8. class s implements Runnable{
  int x=0,y=0;
  int addX(){x++; return x;}
  int addY(){y++; return y;}
  
  public void run()
  {
  for(int i=0;i<10;i++)
  System.out.println(addX()+""+addY());
  }
  
  public static void main(String args[])
  {
  s run=new s();
  Thread t1=new Thread(run);
  Thread t2=new Thread(run);
  t1.start();
  t2.start();
  }
  }
  
  Compile time Error There is no start method
  Will print in this order 11 22 33厖
  Will print but not exactly in an order (eg: 123124 3厖)
  Will print in this order 12 3厖123厖
  Will print in this order 123厖?.
  
  Ans:C
  9.
  class s implements Runnable{
  int x=0,y=0;
  synchronized void addX(){x++; }
  synchronized void addY(){y++; }
  void addXY(){x++;y++;}
  boolean check() { return (x>y)? true:false;)
  
  public void run()
  {
  ////
  System.out.println(check()); }
  public static void main(String args[])
  { s run=new s();
  Thread t1=new Thread(run);
  Thread t2=new Thread(run);
  t1.start();
  t2.start();
  }
  }
  If this methods are called in which order the check will return true?
  Select all that apply
  call addX() and addY() simultaneously for number of times in run()
  call addY() and addX() simultaneously for number of times in run()
  all addXY() for number of times in run()
  
  Ans:B,C
  
  10. What is the name of the method used to start a thread execution?
  A. init();
  B. start();
  C. run();
  D. resume();
  Ans:B
  
  11. Which two methods may not directly cause a thread to stop
  executing?
  A. sleep();
  B. stop();
  C. yield();
  D. wait();
  E. notify();
  F. notifyAll()
  G. synchronized()
  Ans:EF
  
  12. class Outer{
  class Inner{}
  }
  How will you create an instance of Inner Class out side? Select 2
  Inner a= new Inner();
  Outer o= new Outer();Inner a= new o.Inner();
  Outer o= new Outer();Outer.Inner a= new o.Inner();
  Outer.Inner a= new Outer().new Inner();
  Ans:CD
  
  13. What a static inner class can Access select one
  A. Any variables in the enclosing scope
  B. Final variables in the enclosing scope
  C. Static variables declared in side the method
  D. Static variables declared in side the outer class
  Ans:D
  
  14. What is true about inner class? Select one
  an Inner class can access all variables in the any enclosing scope
  an Inner class can access all variables in the enclosing scope
  an inner class can be declared as private
  an Anonymous inner class can be extended from class and can implement
  an interface
  
  Ans:C
  
  15. A ----- is a class that is a collection which cannot contain any
  duplicate elements which maintains its elements in ascending order.
  SortedSet
  Set
  Sorted Map
  Collection
  TreeSet
  
  Ans: A
  
  16. What is true about Map select one
  A map will order the elements in an order according the key
  A map will use unique key to store value
  A map will use unique key to identify value inside the map
  Ans:C
  17. Which Method Returns the parent part of the pathname of this File
  object, or null if the name has no parent part?
  getParent()
  getParentDir()
  getParentDirectory()
  parentDirectory()
  
  Ans:a
  
  18. Which class should be used in situations that require writing
  characters rather than bytes.
  LineNumberWriter
  PrintWriter
  PrintStream
  PrintOutputReader
  Ans:B
  
  19. To Write End of a File f=new File(C:\\hello.txt");
  new RandomAccessFile(f,"rw").writeByte(?;
  FileInputStream fis=new FileInputStream(f,true);
  DataInputStream d=new DatainputStream(fis);
  d.writeBytes(?
  FilterInputStream fis=new FilterInputStream(f,true);
  DataInputStream d=new DatainputStream(fis);
  d.writeBytes(?
  D. FileOutputStream fis=new FileOutputStream(f);
  DataOutputStream d=new DataOutputStream(fis);
  d.writeBytes(?
  E
上一篇:Java的故事 人气:420
下一篇:Java初学者福音——自动设置环境变量 人气:513
浏览全部Java的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-9-6 Movie34电影搜索引擎 v3.0
2008-9-6 wap2.0仿帝国建站喜用 v2.0
2008-9-6 免费人才招聘网 宽屏版 v3.01
2008-9-6 喜喔喔视频采集程序 v1.0 beta
2008-9-6 ASP客户管理系统
2008-9-6 主流驿站中秋祝福程序
2008-9-6 php实现msn协议的类
2008-9-5 Coppermine Photo Gallery v1.4.
2008-9-5 清松网络日记本 v2.4
2008-8-23 Mini WinMount V0.4
2008-8-23 Vista优化大师3.11正式版
2008-8-23 Wine 1.13
2008-8-23 KlipFolio 5.0 Build 5899-80
2008-8-23 Windows Sysinternals Desktops
2008-8-23 OneTap Movies1.2破解版
2008-8-23 AnnotaterPDF阅读1.1.503 破解版
2008-8-23 SoundMeter分贝测量仪 v1.0汉化破
2008-8-23 iDrum音乐节拍1.0破解版
  发表评论
姓 名: 验证码:
内 容:
站长工具:网站收录查询 | Google PR查询 | ALEXA排名查询 | CSS在线编辑器 | 广告代码 | Html转换js | js/vbs加密 | md5加密 | 进制转换
实用工具:汉字翻译拼音 | 符号对照表 | 个税计算 | 经典小工具 | 汉字简繁转换 | 普通单位换算 | 公制单位换算 | 生辰老黄历 | 国内电话区号 国家代码与域名缩写 | 文字加密解密 | 健康查询 | 万年历 | 汉字横竖排版 | 手机号码查询 | 计算器 | ip搜索
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号