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. 如何正确的在java web配置数据池

    在tomcat context.xml中配置数据 <Context reloadable="true"> <!-- Default set of monitore ...

  2. Sqlite出现SQL error: database disk image is malformed的处理

    SQLite有一个很严重的缺点就是不提供Repair命令.导致死亡提示database disk image is malformed它的产生有很多种可能,比如,磁盘空间不足,还有就是写入数据过程中突 ...

  3. spring mvc项目【转载】

    用了好几年的ssh2.最近打算研究下spring的mvc,看看如何,可以的话后期的项目将都是用springmvc+spring jdbc的形式,这样就少了其他框架的继承.由于以前没用过springmv ...

  4. 安装CDH

    Cloudera Manager 4.8.2 http://www.idefs.com/recordsubuntu-12-04-cloudera-installation-manager-4-8-2- ...

  5. 说说读卡应用那点事儿,以SCL010为例

    前一阵子的项目, 跟读卡应用有关,这篇博客算是我学习智能卡方面知识的而一个总结,也可以看作这个领域的一个很简单的简介,他写得很不书面,更像是沿着我自己认识过程的总结.所以这里面有很多我自己理解的地方, ...

  6. 基于mini2440的IIC读写(裸机)

    mini2440开发板提供的测试代码过于复杂,让人很难理解,而且有些错误,如GPE14-15不能设置上拉电阻,可是代码里却设置了,虽然无关紧要.为了方便学习,我在闲暇之时我研究了一下.IIC的原理是比 ...

  7. javascript (string 部分)

    <html> <body> <script type="text/javascript"> var str="ab:cd:ef:gh& ...

  8. 使用Atlas实现MySQL读写分离+MySQL-(Master-Slave)配置

    参考博文: MySQL-(Master-Slave)配置  本人按照博友北在北方的配置已成功  我使用的是 mysql5.6.27版本. 使用Atlas实现MySQL读写分离 数据切分——Atlas读 ...

  9. ThinkPHP分页类

    第一种:利用Page类和limit方法 $User = M('User'); // 实例化User对象$count      = $User->where('status=1')->cou ...

  10. C++标准库类型vector及迭代器iterator简介

    Vector是C++标准库类型,称为容器,一个容器中的所有对象必须是同一种类型的.与数组相比,其最大的优点就是动态增长.Vector是一个类模板,并不是数据类型,而vector<int>和 ...