
正文
java标准化题库代码 java题目库
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
求java试题库管理系统源代码
试题库管理系统 题目 分值 统计 随机抽取
java web == kaifa
相关问答
Q1: (java)题库中有20道题,随机抽10道不同的题出来 怎么写代码 在线等啊
import java.util.*;
class Untitled {
public static void main(String[] args) throws Exception {
Integer[] questions = generateQuestions();
for(Integer question : questions) {
System.out.println(question);
}
}
private static Integer[] generateQuestions() {
ListInteger questionNumbers = new ArrayListInteger();
Random rand = new Random();
int questionNumber, i = 0;
while(i 10) {
questionNumber = rand.nextInt(21);
if(!questionNumbers.contains(questionNumber)) {
questionNumbers.add(questionNumber);
i ++;
}
}
return questionNumbers.toArray(new Integer[10]);
}
}
Q2: 求用java编写的 试卷生成与题库管理系统的源代码? 加上详细的注释就更好了
在百度上面想要这种收费的代码基本上是不太可能的!
还有你说也太笼统了吧!试卷生成和题库管理系统这里面有详细的要求吗?
要求都没有,基本上都不能开发制作的
Q3: java面试题求代码,最好有注解。。。
你好,代码如下。需要修改的话,你可以根据情况修改:
class Info{ // 定义信息类
private String name = "生产者"; // 定义name属性
private String content = "压入子弹" ; // 定义content属性
private boolean flag = false ; // 设置标志位
public synchronized void set(String name,String content){
if(!flag){
try{
super.wait() ;
}catch(InterruptedException e){
e.printStackTrace() ;
}
}
this.setName(name) ; // 设置名称
try{
Thread.sleep(300) ;
}catch(InterruptedException e){
e.printStackTrace() ;
}
this.setContent(content) ; // 设置内容
flag = false ; // 改变标志位,表示可以取走
super.notify() ;
}
public synchronized void get(){
if(flag){
try{
super.wait() ;
}catch(InterruptedException e){
e.printStackTrace() ;
}
}
try{
Thread.sleep(300) ;
}catch(InterruptedException e){
e.printStackTrace() ;
}
System.out.println(this.getName() +
" -- " + this.getContent()) ;
flag = true ; // 改变标志位,表示可以生产
super.notify() ;
}
public void setName(String name){
this.name = name ;
}
public void setContent(String content){
this.content = content ;
}
public String getName(){
return this.name ;
}
public String getContent(){
return this.content ;
}
};
class Producer implements Runnable{ // 通过Runnable实现多线程
private Info info = null ; // 保存Info引用
public Producer(Info info){
this.info = info ;
}
public void run(){
boolean flag = false ; // 定义标记位
for(int i=0;i12;i++){
if(flag){
this.info.set("生产者","压入子弹") ; // 设置名称
flag = false ;
}else{
this.info.set("消费者","射出子弹") ; // 设置名称
flag = true ;
}
}
}
};
class Consumer implements Runnable{
private Info info = null ;
public Consumer(Info info){
this.info = info ;
}
public void run(){
for(int i=0;i24;i++){
this.info.get() ;
}
}
};
public class ThreadCaseDemo03{
public static void main(String args[]){
Info info = new Info(); // 实例化Info对象
Producer pro = new Producer(info) ; // 生产者
Consumer con = new Consumer(info) ; // 消费者
new Thread(pro).start() ;
new Thread(con).start() ;
}
};
关于java标准化题库代码和java题目库的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。








