笔记1:熊熊熊猫开始敲代码啦
来源:互联网 发布:施工日记的软件 编辑:程序博客网 时间:2024/04/30 21:53
已是大四狗,, 才开始学习不晚吧, 求大神支支招怎么高效学习啊 学习步骤 要看什么书 做什么项目之类的
HelloWorld起步 ,CMD编译运行成功。
继续书上的Hello.java eclipse中运行, 把名字改了下
public class Hello{public static void main (String args[]){System.out.println("simple program");Student stu=new Student();stu.speak("we are student");}<pre name="code" class="html">class Student{public void speak(String s){System.out.println(s);<span style="white-space:pre"></span>}<span style="white-space:pre"></span>}}但是会提示No enclosing instance of type Hello is accessible. Must qualify the allocation with an enclosing instance of type Hello (e.g. x.new A() where x is an instance of Hello). 至于什么意思 我也不清楚 我想就是说少了什么东西吧, 随后在class student 前加了个static 没错了 成功运行。
之后写书上另一个联合编译程序的时候,无意中想到要是颠倒一下class类的顺序会怎么样(因为以前C语言里面就有一个 如果有其他调用,main在前面的话 需要在main里也写出来 ) 结果根本不需要加static 也可以运行 如下:
class Student{public void speak(String s){System.out.println(s);}}public class Hello{public static void main (String args[]){System.out.println("simple program");Student stu=new Student();stu.speak("we are student");}}记录一下, 原因什么的我也不清楚。。。
0 0
- 笔记1:熊熊熊猫开始敲代码啦
- 开始写学习笔记啦
- 开始写学习笔记啦。。。。
- 开始整理学习笔记啦~~~
- 熊猫烧香--核心代码1
- 开始啦开始啦
- Android《第一行代码》学习开始啦
- <<熊猫围棋助手>>发布啦
- 开始奋斗啦啦。。
- 开始啦
- 开始啦~
- 开始啦!
- 开始啦!
- 开始啦
- 开始啦!
- 开始啦
- 开始啦
- 开始啦
- 各互联网公司offer比较
- 类作用域
- Locality Sensitive Hashing ( LSH,局部敏感哈希 ) 详解
- 网络流_最大流_POJ 3281
- 两个小算法(十进制转二进制和求二叉树的叶子数目)附源码
- 笔记1:熊熊熊猫开始敲代码啦
- Spring为属性注入某个类的常量或方法的返回值
- UIView放大动画
- 关于错误:无法打开源文件"CCVector.h"这类问题的解决方法
- ios-使用TBXML解析XML文件
- 手把手教你ARC——ARC入门和使用
- 反向索引(Inverted Index)
- python for in 语法 一览
- 【SSH三大框架】Struts2基础第八篇:Struts2用AJAX实现JSON插件的使用