Java概述、环境变量、注释、关键字、标识符、常量

Java语言的特点
        有很多小特点,重点有两个开源,跨平台
 Java语言是跨平台的

Java语言的平台
        JavaSE
        JavaME--Android
        JavaEE

DK,JRE,JVM的作用及关系(掌握)
    (1)作用
        JVM:保证Java语言跨平台  (虚拟机)
        JRE:Java程序的运行环境
        JDK:Java程序的开发环境
    (2)关系
        JDK:JRE+工具
        JRE:JVM+类库

helloWorld案例
   public class HelloWorld {
        public static void main(String[] args) {
            System.out.println("HelloWorld");
        }
    }

Java程序的最基本单位是类  。Java程序要想执行,必须有main方法。

Java程序的开发执行流程:
        A:编写java源程序(.java)
        B:通过javac命令编译生成.class文件
        C:通过java命令运行(虚拟机jvm).class文件

path环境变量的作用
        保证javac命令可以在任意目录下运行

path环境变量(方法)

找到环境变量的位置,在系统变量里面
            新建:
                变量名:JAVA_HOME
                变量值:D:\develop\Java\jdk1.7.0_60
            修改:
                变量名:Path
                变量值:%JAVA_HOME%\bin;以前的内容
注释:单行注释// 多行注释/**/  文档注释/**  */

关键字:全部小写

标识符:

一组成元素

 1 英文字符: a-zA-Z

 2数字: 0-9

 3符号: _与$

  二、标识符规则

  1数字不能开头

  2不可以使用关键字

  3严格区分大小写,不限制长度起名时,尽量达到见名知意

常见的命名规则(见名知意)
        A:包    全部小写
            单级包:小写
                举例:liuyi,com
            多级包:小写,并用.隔开
                举例:cn.itcast,com.baidu                
        B:类或者接口
            一个单词:首字母大写
                举例:Student,Demo
            多个单词:每个单词首字母大写
                举例:HelloWorld,StudentName
        C:方法或者变量
            一个单词:首字母小写
                举例:name,main
            多个单词:从第二个单词开始,每个单词首字母大写
                举例:studentAge,showAllNames()
        D:常量
            全部大写
            一个单词:大写
                举例:PI
            多个单词:大写,并用_隔开
                举例:STUDENT_MAX_AGE

 

常量(掌握)
  在程序执行的过程中,其值不发生改变的量

 

转载于:https://www.cnblogs.com/w-xibao/p/7861120.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/390792.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

写游戏软件要学什么_为什么要写关于您所知道的(或所学到的)的内容

写游戏软件要学什么Im either comfortably retired or unemployed, I havent decided which. What I do know is that I am not yet ready for decades of hard-won knowledge to lie fallow. Still driven to learn new technologies and to develop new projects, I see the …

leetcode 342. 4的幂

给定一个整数,写一个函数来判断它是否是 4 的幂次方。如果是,返回 true ;否则,返回 false 。 整数 n 是 4 的幂次方需满足:存在整数 x 使得 n 4x 示例 1: 输入:n 16 输出:true …

梯度反传_反事实政策梯度解释

梯度反传Among many of its challenges, multi-agent reinforcement learning has one obstacle that is overlooked: “credit assignment.” To explain this concept, let’s first take a look at an example…在许多挑战中,多主体强化学习有一个被忽略的障碍&a…

三款功能强大代码比较工具Beyond compare、DiffMerge、WinMerge

我们经常会遇到需要比较同一文件的不同版本,特别是代码文件。如果人工去对比查看,势必费时实力还会出现纰漏和错误,因此我们需要借助一些代码比较的工具来自动完成这些工作。这里介绍3款比较流行且功能强大的工具。 1. Beyond compare这是一款…

shell脚本_Shell脚本

shell脚本In the command line, a shell script is an executable file that contains a set of instructions that the shell will execute. Its main purpose is to reduce a set of instructions (or commands) in just one file. Also it can handle some logic because it…

大数据与Hadoop

大数据的定义 大数据是指无法在一定时间内用常规软件工具对其内容进行抓取、管理和处理的数据集合。 大数据的概念–4VXV 1,数据量大(Volume)2,类型繁多(Variety )3,速度快时效高(Velocity)4,价值密度低…

Arm汇编指令学习

ARM指令格式 ARM指令格式解析 opcode: 指令助记符,例如,MOV ,ADD,SUB等等 cond:指令条件码表.下面附一张图 {S}:是否影响CPSR的值. {.W .N}:指令宽度说明符,无论是ARM代码还是Thumb(armv6t2或更高版本)代码都可以在其中使用.W宽度说明符&…

facebook.com_如何降低电子商务的Facebook CPM

facebook.comWith the 2020 election looming, Facebook advertisers and e-commerce stores are going to continually see their ad costs go up as the date gets closer (if they haven’t already).随着2020年选举的临近,随着日期越来越近,Facebook…

Python中的If,Elif和Else语句

如果Elif Else声明 (If Elif Else Statements) The if/elif/else structure is a common way to control the flow of a program, allowing you to execute specific blocks of code depending on the value of some data.if / elif / else结构是控制程序流程的常用方法&#x…

Hadoop安装及配置

Hadoop的三种运行模式 单机模式(Standalone,独立或本地模式):安装简单,运行时只启动单个进程,仅调试用途;伪分布模式(Pseudo-Distributed):在单节点上同时启动namenode、datanode、secondarynamenode、resourcemanage…

漏洞发布平台-安百科技

一个不错的漏洞发布平台:https://vul.anbai.com/ 转载于:https://blog.51cto.com/antivirusjo/2093758

Android 微信分享图片

private String APP_ID "00000000000000000"; //微信 APPID private IWXAPI iwxapi; private void regToWx() {iwxapi WXAPIFactory.createWXAPI(context, APP_ID, true);//这里context记得初始化iwxapi.registerApp(APP_ID); } IMServer.getDiskBitmap(IMServer.u…

蒙蒂霍尔问题_常见的逻辑难题–骑士和刀,蒙蒂·霍尔和就餐哲学家的问题解释...

蒙蒂霍尔问题While not strictly related to programming, logic puzzles are a good warm up to your next coding session. You may encounter a logic puzzle in your next technical interview as a way to judge your problem solving skills, so its worth being prepare…

西格尔零点猜想_我从埃里克·西格尔学到的东西

西格尔零点猜想I finished reading Eric Siegel’s Predictive Analytics. And I have to say it was an awesome read. How do I define an awesome or great book? A book that changes your attitude permanently. You must not be the same person that you were before y…

C/C++实现删除字符串的首尾空格

StdStringTrimTest.cpp #include <iostream> int main() {std::string str(" 字符串 String ");std::cout << str << std::endl;std::cout << str.size() << std::endl;str.erase(str.find_first_of( ), str.find_first_not_of…

assign复制对象_JavaScript标准对象:assign,values,hasOwnProperty和getOwnPropertyNames方法介绍...

assign复制对象In JavaScript, the Object data type is used to store key value pairs, and like the Array data type, contain many useful methods. These are some useful methods youll use while working with objects.在JavaScript中&#xff0c; Object数据类型用于存…

HDFS 技术

HDFS定义 Hadoop Distributed File System&#xff0c;是一个使用 Java 实现的、分布式的、可横向扩展的文件系 统&#xff0c;是 HADOOP 的核心组件 HDFS特点 处理超大文件流式地访问数据运行于廉价的商用机器集群上&#xff1b; HDFS 不适合以下场合&#xff1a;低延迟数据…

深度学习算法和机器学习算法_啊哈! 4种流行的机器学习算法的片刻

深度学习算法和机器学习算法Most people are either in two camps:大多数人都在两个营地中&#xff1a; I don’t understand these machine learning algorithms. 我不了解这些机器学习算法。 I understand how the algorithms work, but not why they work. 我理解的算法是如…

Python第一次周考(0402)

2019独角兽企业重金招聘Python工程师标准>>> 一、单选 1、Python3中下列语句错误的有哪些&#xff1f; A s input() B s raw_input() C print(hello world.) D print(hello world.) 2、下面哪个是 Pycharm 在 Windows 下 默认 用于“批量注释”的快捷键 A Ctrl d…

express 路由中间件_Express通过示例进行解释-安装,路由,中间件等

express 路由中间件表达 (Express) When it comes to build web applications using Node.js, creating a server can take a lot of time. Over the years Node.js has matured enough due to the support from community. Using Node.js as a backend for web applications a…