楼主: MoodyYang

打算开始学Java,立此存照

[复制链接]
论坛徽章:
13
ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15
11#
 楼主| 发表于 2007-9-28 14:14 | 只看该作者
比圖片更帥? 嗯嗯,我們部門還有幾個單身的MM。。。

使用道具 举报

回复
论坛徽章:
13
ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15
12#
 楼主| 发表于 2007-9-28 14:14 | 只看该作者
Back to Java.

1.1 hello world and 1.2 FizzBuzz

1. Using packages provides a unique namespace for every Java program
2. & and &&, = and ==.
BTW, I hate the stupid guy who creates the concept of prioritization. Maybe it is important in era of C to save the memory and improves the efficiency, I am quite sure that we are in 21th century now. The only reason why we still use prioritization is : teacher have to prepare some obscure expression for testing.
The guy who create () is genius.

使用道具 举报

回复
论坛徽章:
12
会员2006贡献徽章
日期:2006-04-17 13:46:34生肖徽章2007版:兔
日期:2009-03-10 21:27:28ERP板块每日发贴之星
日期:2007-10-24 01:04:58ITPUB新首页上线纪念徽章
日期:2007-10-20 08:38:44设计板块每日发贴之星
日期:2007-10-18 01:06:03ITPUB元老
日期:2007-10-11 14:47:20开发板块每日发贴之星
日期:2007-10-10 01:05:30行业板块每日发贴之星
日期:2007-10-01 01:05:12行业板块每日发贴之星
日期:2007-09-30 01:05:35会员2007贡献徽章
日期:2007-09-26 18:42:10
13#
发表于 2007-9-28 15:13 | 只看该作者
不识MAP的人漂过

使用道具 举报

回复
论坛徽章:
13
ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15
14#
 楼主| 发表于 2007-9-28 15:30 | 只看该作者
第三題,菲波納契數列。
有點頭痛。記得以前有一個很優美的遞歸方式來做這個,可是完全沒有概念了。只好醜陋的開始申請一大堆變量。
邭獠诲e,咚愠鰜斫Y果還是對的。比照一下題上的答案,原來也好不到哪裏去。不過,他變量的命名比我清楚很多,用的是N2,N1,N0。另外,對於函數他也更清楚。
程序要寫得優美,一定要多些多看。附上一個標本,希望我以後不要再寫這樣死的程序

public class Fibonacci {
        /**
         * @param args
         */
        public static void main(String[] args) {
                // TODO Auto-generated method stub
                int i=1;
                int j=1;
                int k=1;
                System.out.println(i);
                System.out.println(j);
                for (int count=1; count<=18; count++){
                        k=i+j;
                        i=j;
                        j=k;
                        System.out.println(k);
                }
        }
}

使用道具 举报

回复
论坛徽章:
13
ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15
15#
 楼主| 发表于 2007-9-28 16:22 | 只看该作者
1.4 Command-Line argument

Array / Pointer is the most important thing in C. On another hand, they are most difficult thing in C too. After learning the behavior of stack, it will make beginner headache for couples of weeks.

On my short experience of being a teacher, I “heard” that Jave ban pointer because of some reasons. Pointer is quite good after you master it and also quite bad before you master it. It is said that some fans of pointer have successfully use pointer in Java but I think that is not necessary. Good for use and increase the robust of your program is the most important thing in application.

  Let’s back to Array. Since the No.1 trouble-maker is not exist in Java, Array (with out pointer of array) is not so difficult.

  See the program itself. Find out where to input the argument trouble me most because I am not familiar with eclipse. Finally I find it in: Run->Open Run Dialog->Arguments.
Find my program as follow. Take care I have reverse the order of arguments.

for(int i=1; i<=args.length; i++)
                        System.out.print(args[(args.length-i)]+" ";

I find I make a same mistake with author because I leave a useless blank in end of output. But I have not find a good way to eliminate the extra blank & keep program in short, I decide skip this small annoyance

使用道具 举报

回复
论坛徽章:
13
ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15
16#
 楼主| 发表于 2007-9-28 16:31 | 只看该作者
I found a post on web service besides this one. I am sure I have lot of thing to learn since I just finish running “Hello world” in 20 hours.

使用道具 举报

回复
论坛徽章:
13
ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15
17#
 楼主| 发表于 2007-9-28 17:36 | 只看该作者
1.5 Reverse
原來後面就是Reverse,還更徹底。
遇到一個小問題,請問Eclipse怎樣進行單步調試?

使用道具 举报

回复
论坛徽章:
13
ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15
18#
 楼主| 发表于 2007-10-1 18:43 | 只看该作者
最近几天在广州朋友这边玩,上来瞅瞅发现还是很热闹的。

想到一个问题:当年学C的时候有MFC/STL, Java也是跑不掉的吧。哪里有函数库的手册之类的下载?知道的兄弟请吭一声。谢谢

使用道具 举报

回复
论坛徽章:
131
乌索普
日期:2017-09-26 13:06:30马上加薪
日期:2014-11-22 01:34:242014年世界杯参赛球队: 尼日利亚
日期:2014-06-17 15:23:23马上有对象
日期:2014-05-11 19:35:172014年新春福章
日期:2014-04-04 16:16:58马上有对象
日期:2014-03-08 16:50:54马上加薪
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14
19#
发表于 2007-10-1 20:24 | 只看该作者
sun网站有的吧, 或者google

使用道具 举报

回复
论坛徽章:
13
ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15
20#
 楼主| 发表于 2007-10-1 22:26 | 只看该作者
应该有一些书可以下载,然后有一些例子,很容易查询使用的那种吧.

明天晚上回家,去搜索一下...

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表