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

源代码不能编译应用

发布时间: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++,点击菜单栏中的“工具”,点击“编译选项”,打开编辑选项对话框。

阅读全文

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

热点内容
plc编译后错误18 浏览:612
python数组分片 浏览:251
linux图形化编程 浏览:176
阿里国际站app端怎么装修 浏览:528
微信小程序云开发简单搭建源码 浏览:851
以后缺程序员吗 浏览:294
jsp源码不能运行 浏览:363
淘客助手源码下载 浏览:733
如何使用app记账报税 浏览:562
python线程捕捉键盘 浏览:25
地推统计图app怎么做 浏览:162
android文件夹不能用了 浏览:857
加密软件的日志 浏览:892
肾病pdf 浏览:230
网站怎么用本地服务器 浏览:120
javadoc导入android 浏览:517
文件扫描成pdf 浏览:696
凉山火灾救援命令 浏览:54
压缩机三相检测 浏览:861
linux怎么安装光盘 浏览:799