java基础编程之入门

Java的(六大)特点:
1.简单性
相对于c语言来说
c语言的核心 指针(保存地址)*p
Java中没有指针的概念(使用的是引用概念)

2.面向对象(懒人思想)
类 对象 接口
面向对象的特性:封装 继承 多态

3.分布式
双十一京东淘宝 1000亿 5000万访问量 访问他们的服务器
若只有1台服务器 压力比较大
多台服务器共同支持同一个业务

4.跨平台性(系统)
JDK 程序开发包(包含了JRE和JVM)
JRE 程序的运行环境(包含了JVM)
JVM Java虚拟机
Java代码运行在虚拟机上
Mac系统 安装一个Mac版的JVM
window系统 安装一个Window版的JVM
Java文件后缀:.java
注意:.Java文件不能直接运行,需要一个编译的过程.class文件(虚拟机能运行的文件)

5.安全性(内存方面)
Java内存处理机制:
GC 垃圾回收机制:延迟回收(延迟处理),某一时刻,会被系统自动回收(轮寻)

6.健壮性(让你的网站增加容错性)
Java属于强类型语言(严格区分大小写)
异常处理机制:提示用户
java中最开始,你要先了解什么是标识符,命名的规范性等,以及基本的那几行代码的含义.

**java中的标识符**
    类名 变量名 接口名
    标识符的命名规范
    只能以数字 字母 下划线_ 美元符号$ 开头

**类名命名规范:**
    使用大驼峰命名:单词首字母大写,多个单词时每个单词首字母大写
    小驼峰命名:(定义变量名使用)
    第一个单词首字母小写,除了第一个单词外,其他单词首字母大写
    注意:起名时,必须见名知意;java中的关键字:系统提供的已经有特殊意义的单词(系统用了,就不能再用)

**变量和常量**
    常量:程序运行中不会更改的量就是常量
    变量:存储数据
    数据类型 变量名=初值;

**数据类型:**
    一.基本数据类型 :
        1.整型:
            1.byte字节型:表示一个字节(一个字节用八个二进制位来表示)可以存储一个字节大小的数据
            2.short:短整型 两个字节
            3.int整型(常用):四个字节
            4.long长整型:八个字节
         2.浮点型:
            1.float:四个字节
            2.double(常用 默认声明的小数系统使用double类型):八字节
        3.字符型:
            1.char
            特点:可以与整型相互转换 
        4.boolean 布尔类型:

二.引用数据类型

字符串类型:
    比较特殊 本身是一个类 但是使用方法和基本数据类型相同
    String 

类和接口

package com.lanou3g;//包名

//单行注释

/*
 * 多行注释
 */
/**
 * 文档注释javadoc
 * (可以把文档注释使用编译指令生成开发文档)
 * @author konglinglei
 *
 *
 */
public class HelloWorld {
//入口函数
    public static void main(String[] args) {

        //打印
        System.out.println("拥抱这个世界");
        //打印快捷键
        System.out.println("哈哈");
        System.out.println(3);
        //声明一个整形变量
        //等号两边加空格隔开
        int number = 10;
        number = 15;
        //字符型变量
        //声明的字符要用单引号
        char c = 'R';
        System.out.println(number);
        //强制转化 把字符型转换成整
        //97在ASCII表中表示小a
        //65在ASCII表中表示
        System.out.println((int)c);
        //数字强转为字符型
        System.out.println((char)100);

    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Programming is an art. Although traditional art imitates life, programming simulates life. Every abstract concept in programming, and to a great extent in the fi eld of computer science, has its roots in our daily life. For example, humans and possibly all other living forms were multiprocessing long before the term entered into computer science lingo. Th erefore, any concept in programming can in fact be illustrated through examples from our dayto-day life. Such an approach not only enables the student to assimilate and internalize the concept presented in a programming situation but also provides a solid foundation for the very process of programming, namely, the simulation of the real world. Unfortunately, textbooks currently on the market do not exploit this fact through examples or meaningful discussions. Th us, for many students, an abstract concept remains abstract. Th is is especially true in the case of object-oriented programming. Th e “wow moment” one gets by seeing programming as a simulation of the real-world situation is never realized. Th is book on Java programming teaches object-oriented design and programming principles in a completely integrated and incremental fashion. Th is book allows the reader to experience the world we live in as object-oriented. From the very outset the reader will realize that everything in this world is an object. Every concept of object-oriented design is fi rst illustrated through real-life analogy. Corresponding Java language constructs are introduced in an integrated fashion to demonstrate the programming required to simulate the real-world situation. Instead of compartmentalizing all the object-oriented concepts into one chapter, this book takes an incremental approach. Th e pedagogy of this book mirrors the classroom style the author has developed over the years as a teacher of computer science. In particular, every programming concept is introduced through simple examples followed by short programming examples. Case studies at the end of each chapter illustrate various design issues as well as the usefulness of many new concepts encountered in that chapter. Java has emerged as the primary language for soft ware development. From a soft ware engineering perspective, object-oriented design has established itself as the industry standard. Th us, more and more teaching institutions are moving toward a CS1 course that teaches Java programming and object-oriented design principles. A common approach followed in many textbooks on the market is to introduce object-oriented concepts from the very beginning and ignore many traditional programming techniques completely. Th e objective of this book is to present object-oriented programming and design without compromising the training one needs on traditional programming constructs and structures.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值