cmd使用
进入硬盘分区:D: E: F:
查看目录 dir
进入文件夹 “cd 文件名”
.使用javac编译器编译运行。
  Javac 文件名
运行java程序
Java 文件名
第一个程序
public class hello
{
public static void main(String[] arg)
{
System.out.println("hello world");
} }
第二个程序
public class hello
{
public static void main(String[] arg)
{
int s=0;
for(int i=1;i<=100;++i)
s+=i;
System.out.println(s);
} }
第三个程序
public class hello
{
public static void main(String[] arg)
{
int s=0;
for(int i=1;i<=100;++i)
s+=i;
System.out.println(s);
} } class A
{}
class B
{}
class C
{} 会生成四个文件。 了解JVM运行过程
JAVA 编程规范 栈空间:引用变量、基本数据类型、int,float,short,double 默认值为随机的,并且会报错。
堆空间:new分配堆空间,默为值为\0即NULL 变量
特性:
  名称:$,字母,下划线可作变量名发头,数字不可以作为开头。
  类型:
  初始值:
  作用域 :
Java中两大数据类型: 基本数据类型:byte,boolean,char,short,int,long,float,double
byte:8位符号整数,boolean:bool类只有ture和flase
引用数据类型:class interface 数组 基本数据类型之间的转换:
不同类型的变量运算,......... 运算符:
.................................
Instanceof 是否是该类的对象。
& 为双目运算,两边的类型必须要相同。
>>> 无符号位移 第三个程序:
public class hello
{
public static void main(String[] arg)
{
int i=1;
switch(i)
{
case 1:System.out.println("A");break;
case 2:System.out.println("B");break;
case 3:System.out.println("C");break;
default:System.out.println("D");break;
}
} } public class hello
{
public static void main(String[] arg)
{
int i=1;
switch(i)
{
case 1:System.out.println("A");
case 2:System.out.println("B");
case 3:System.out.println("C");
default:System.out.println("D");
}
} } 第四个程序:
public class hello
{
public static void main(String[] arg)
{
int x=10; if(x<1)
System.out.println(x);
else if(1<=x&&x<10)
System.out.println(3*x-2);
else
System.out.println(4*x); } } 第五个程序:
public class hello
{
public static void main(String[] arg)
{
int x=1; while(x<5)
{
if(i==3)
{
break;
}
++i;
System.out.println(x);
} } } 第六个程序:
public class hello
{
public static void main(String[] arg)
{
int x=1; while(x<5)
{
if(i==3)
{
continue; //进入死循环
  }
++i;
System.out.println(x);
}
} }

Java_1Lesson的更多相关文章

随机推荐

  1. Qt之QNetworkInterface(查询网络接口),QHostInfo(查询主机IP)

    http://blog.csdn.net/u011012932/article/details/50775052 http://blog.csdn.net/u011012932/article/det ...

  2. VC6中创建Qt工程的创建

    文章来源:http://blog.sina.com.cn/s/blog_64d015c10100sf1o.html 本文主要介绍怎么创建可以在VC6中编译的QT工程.本文所采用环境为VC++6.0+Q ...

  3. 基于visual Studio2013解决C语言竞赛题之0302字符数出

     题目 解决代码及点评 根据题目要求,只要根据用户输入的字母,判断字母之后,给出相应的输出即可 在以下代码中,f32函数实现了该功能,通过if条件判断语句 #include <stdio.h ...

  4. IT第九天 - 包、访问修饰符、变量的内存分配、String类中常用方法

    IT第九天 上午 包 1.包的命名规则:域名.项目名称.模块名 2.如:Wfei.com.windows.login 访问限制符 1.四种访问限制符分别对应为: (1)default:默认的,默认为p ...

  5. win32多线程程序设计笔记(第四章下)

    上一笔记讲了同步机制中的临界区域(Critical Sections).互斥器(Mutexes),下面介绍同步机制中的另外两种. 信号量(Semaphores) 举个例子: 现在有人要租车,接待他的代 ...

  6. 关于 javascript event flow 的一个bug

    [1]描述了firefox,safari 有一个bug和DOM 3 规范不一致:在event.currentTarget等于event.target的时候(即event flow处于target ph ...

  7. [置顶] android AIDL 进程间通信

    1.定义aidl文件 a.ITestService.aidl package com.open.aidl.service; import com.open.aidl.service.ITestServ ...

  8. Yii Framework2.0开发教程(2)使用表单Form

    第一步.接着教程(1).我们在controllers/ZhyoulunController.php中加入两处, 1) use app\models\EntryForm; 和 2) public fun ...

  9. MySQL 讨厌哪种类型的查询

    ㈠ 任何查询都讨厌             只要是查询.MySQL都讨厌.执行查询最快的方式就是不去执行        缓存为王.比如Redis或者memcache               ㈡ 查 ...

  10. layout_weight属性详解

    看到上面这段代码,大家肯定认为三个TextView的宽度是1:2:2,但实际上是如图1这样的,宽度之比确实是1:2:2,但为什么第一个和后两个是齐平的呢?下面我给大家画一条线,可以看到虽然控件是没有对 ...