导航:首页 > 源码编译 > 源代码不能编译应用

源代码不能编译应用

发布时间:2024-09-30 22:53:51

Ⅰ head first java专家术语学习机 源代码为什么不能编译

首先,集合类(或者叫容器)不能放基本数据类型,必须是类。所以应把所有的ArrayList<int>改成ArrayList<Integer>;
其次,被private修饰的属性(变量)都不能被其它类访问,改成其它权限即可。
import java.io.*;
import java.util.ArrayList;

public class SimpleDotComTestDrive{
public static void main(String[] args){
int numofguess=0;
GameHelper helper=new GameHelper();
SimpleDotCom theDotCom=new SimpleDotCom();
theDotCom.setLocationCells(theDotCom.locations);
boolean isAlive=true;
while(isAlive==true){
String guess=helper.getUserInput("enter a number");
String result=theDotCom.checkYourself(guess);
numofguess++;
if(result.equals("Kill")){
isAlive=false;
System.out.println("You took "+numofguess+" guesses");
}
}
}
}

class SimpleDotCom{
ArrayList<Integer> locations=new ArrayList<Integer>();
public String checkYourself(String userguess){
String result="miss";
int guess=Integer.parseInt(userguess);
int index=locations.indexOf(guess);
if(index>0){
locations.remove(index);
result="Hit";
}
if(locations.isEmpty()){
result="Kill";
}
System.out.println(result);
return result;
}
public void setLocationCells(ArrayList<Integer> a){
int randomnum1=(int)(Math.random()*5);
int randomnum2=randomnum1+1;
int randomnum3=randomnum2+1;
a.add(randomnum1);
a.add(randomnum2);
a.add(randomnum3);
}

}

class GameHelper{
public String getUserInput(String prompt){
String inputLine=null;
System.out.print(prompt+" ");
try{
BufferedReader is=new BufferedReader(new InputStreamReader(System.in));
inputLine=is.readLine();
if(inputLine.length()==0)
return null;
}
catch(IOException e){
System.out.println("IOException"+e);
}
return inputLine;
}
}

Ⅱ 源代码未编译什么情况

这些语言在写完后缀名是.c,这个时候要先编译成.h,才能运行。
所以你保存后要先点编译,然后才能点运行。
编译键一般在运行键旁边啦,你点击了再看行不行,有时如果你的文件有错误,编译的时候会报错出现error和警告,只有程序是正确的,你才能编译通过,再运行
七爪

Ⅲ [100分求解]:Dev-C++编译.c文件时提示"源文件未编译"无法运行 而把后缀改成.cpp后正常运行

原因:设置错误导致。解决方法:

如下参考:

1.首先,打开dev-c++,点击菜单栏中的“工具”,点击“编译选项”,打开编辑选项对话框。

阅读全文

与源代码不能编译应用相关的资料

热点内容
命令行关闭端口 浏览:652
加密频道收视 浏览:484
java的GUI组件 浏览:656
怎么查询化妆品牌的真伪app 浏览:861
单机化命令 浏览:548
使用adb命令导出日志 浏览:901
富贵包正骨按摩解压视频 浏览:815
电脑硬盘夹怎么加密 浏览:627
dosping命令 浏览:856
源代码不能编译应用 浏览:733
文件加密宝怎么用 浏览:384
优势命令模式 浏览:545
小程序前端防反编译 浏览:451
要如何连接手机的服务器 浏览:779
游客app怎么样 浏览:394
空调压缩机焊接 浏览:338
数控编程中怎么扩孔 浏览:960
数字电视技术pdf 浏览:517
老电脑怎么用服务器系统 浏览:566
硬盘连接文件夹不见了 浏览:143