今天还是在看语法,想自已也不知道写什么,晚上的时候上网看到同学了,和他聊了会长了些知识,而且他给我一些课件,嘿嘿,感觉这个课件挺好,因为是中文的,看四章多,原来的那个参考大全今天看的更慢了,只看了不到十页,不过照着写了些代码,要比昨天写的多一些,因为是照着写的有些错,但也都改正过来了,不过昨天的那个后来我放到根目录下了,结果能运行了,不知道是怎么回事,还有昨天的那个错误提示是什么意思?能帮我翻译一下嘛?感觉我现在的水平自已编不代码,是不是因该再多看一些语法,因为语法我还是不懂,但是现在讲的例子都是短的,所以基本都能看懂!
入门建议先多写程序,后看书。题目就用我给你的那个就行了你指的多写程序是自已写还是抄例子然后自已去分析?还有我一直也没用ECLIPSE,第一太占内存了,我去网上看看了,我下载的这个新版更占内存,还有最主要的是根本不知道怎么用,连往哪写代码都不知道!运行起来超慢!慢到根本法用啊!
对了,今天还看了一个别人写的一段输入5个数求最大最小值,虽然没太看明白,但也了解了一些,这些东西我还头一次接触!
以下是今天抄的代码class ifsample { public static void main (String args []){ int x ,y ; x =10; y=20; if (x<y)System.out.println("x is less than y"); x =x*2; if (x ==y) System.out.println("x now equal to y"); x=x*2; if (x>y) System.out.println("x now greater than y"); if (x==y)System.out.println("you won`t see this"); } }//initialization//这个是输出比较X.Y大小的
class fortest{public static void main(String args []){ int x; for(x=0; x<10;x++ ) System.out.println("this is x:"+x); }}//codeblocks
//这个是求X小于10的数,但后面的x++,也可写成,x+1但是这句我不太懂是什么意思!有没有这句好像都是一样的结果!
class blocktest{ public static void main(String args[]){ int x,y; y=20; for(x=0;x<10;x++){ System.out.println("this is x:" +x); System.out.println("this is y:" +y); y=y-2; } }}//false true null abstract const finally int boolean float interface return throw //break default throws byte native static transient strictfp catch else implements//package super voidchar extends import private switch volatile final instanceof //protected synchronized while这些是我看到的还特意去查了意思!//就这个代码没太看懂是什么意思!
下面这个是别人写的求最大最小值的
import java.io.*; //这里不懂public class china {
public static void main(String[] args)throws IOException //这里不懂 throws IOException这个不知道是什么意思 { int a[]=new int[5]; int max,min; min=max=a[0]; BufferedReader buf=new BufferedReader(new InputStreamReader(System.in)); //也不懂 System.out.println("Input a number:"); for(int i=0;i<a.length;i++) //length的用法我看书了,但是没看懂 { String str=buf.readLine(); a[i]=Integer.parseInt(str); //这里不懂 System.out.println(" "); } min=max=a[0]; for(int i=0;i<a.length;i++) { if(a[i]>max) max=a[i]; if(a[i]<min) min=a[i]; } System.out.println(max); System.out.println(min); }}//虽然没太看懂,但也知道是这样的编写过程了!
今天总体感觉和昨天差不多,学的进度太慢了!