没有合适的资源?快使用搜索试试~ 我知道了~
首页Java编程速查表:从基础到高级概念
Java编程速查表:从基础到高级概念
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 52 浏览量
更新于2024-06-21
收藏 2.53MB PDF 举报
"Java Cheat Sheet 是一份全面的Java编程指南,涵盖了从基础到高级概念的关键知识点。这份文档旨在帮助学习者快速理解和掌握Java语言,包括但不限于术语、基本语法、变量和数据类型、关键字、注释、访问修饰符、运算符、标识符、控制流程、包、方法、多态性、继承、数学类、抽象类与接口、数组、字符串处理、正则表达式、异常处理、命令行操作、集合框架、泛型以及多线程。Java作为一种高级编程语言,以其稳定性、面向对象特性、安全性以及易学性而闻名,创始人James Gosling因其在Java项目中的贡献被誉为"Java之父"。早期名为Oak的Java在商业上已经有一定知名度,为了区分与原有的Oak,团队将编程语言改名为Java。通过这份Cheat Sheet,开发者可以系统地了解并实践Java的核心特性,无论是初学者还是进阶开发者都能从中获益匪浅。"
资源详情
资源推荐
Java Cheat Sheet
3.Variables in Java
In Java, a variable is a data container that stores data values during the execution of
a Java program. A data type is allocated to each variable, indicating the type and
quantity of data it may store. It is a program’s fundamental storage unit. All variables
in Java must be defined before they may be used.
Syntax of declaring a variable:-
datatype variable_name;
Here, datatype refers to the type of data that can be stored in the variable.
variable_name refers to the name of the variable being declared.
In the above image, we can see that a variable named ‘age’ has been declared of type
‘int’ and has been initialised with the value ‘20’.
Types of variables:-
Page 15
Java Cheat Sheet
Local variable
- A local variable is a variable defined within a block, method, or
constructor. These variables have a scope that is limited to the block in which
they are defined. i.e., these variables are only accessible within that block.
Instance variable
- Variables that are declared inside a class without the ‘static’
keyword are referred to as instance variables. Instance variables are replicated
for every object of the class being created.
Static variable
- Variables that are declared inside a class with the ‘static’
keyword are referred to as static variables. Static variables are shared by all the
objects of the class and are not replicated. Static variables are created at the
start of program execution and automatically destroyed when the program is
finished. It is not necessary to initialise a static variable. It has a value of 0 by
default.
4.Datatypes in Java
The different sizes and values that can be stored in the variable are defined by data
types. In Java, there are two types of data types:
Page 16
Java Cheat Sheet
Data Type
Default Size Description
boolean 1 bit
Only two potential values
are stored in the Boolean
data type: true and false.
Simple flags that track
true/false circumstances
are stored in this data
type.
char 2 byte
A single 16-bit Unicode
character is represented
by the char data type. It
has a value range of
‘\u0000’ (or 0) to ‘\uffff’ (or
65,535 inclusive).
byte 1 byte
It’s an 8-bit two-s
complement signed
integer. It has a value
range of -128 to 127.
(inclusive). It has a value of
0 by default. The byte data
type is used to preserve
memory in huge arrays
where space is at a
premium. Because a byte
is four times smaller than
an integer, it saves space.
short 2 bytes
A 16-bit signed two’s
complement integer is the
short data type. It has a
value range of -32,768 to
32,767. (inclusive). It has a
value of 0 by default.
Page 18
Java Cheat Sheet
Non Primitive data types in Java:-
The non-primitive data types in Java include classes, interfaces and arrays. We will
discuss more on them in the upcoming topics.
5.Java Keywords
a) Understanding the this keyword in Java:
The this keyword in java can be used in multiple ways. The following are the use
cases of the this keyword:
this: to refer to the current instance variable of the class
The this keyword can be used to refer to the current instance variable of a class. If
there is any ambiguity between the instance variables and arguments, this keyword
clears things out.
Example -
class
Sample{
int a;
Sample(int a){
this.a=a;
}
void display(){
System.out.println("a = "+a);
}
}
class Test{
public static void main(String args[]){
Sample s1=new Sample(10);
s1.display();
}
}
Output -
a =
10
Page 19
剩余97页未读,继续阅读
珞瑜·
- 粉丝: 11w+
- 资源: 500
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 京瓷TASKalfa系列维修手册:安全与操作指南
- 小波变换在视频压缩中的应用
- Microsoft OfficeXP详解:WordXP、ExcelXP和PowerPointXP
- 雀巢在线媒介投放策划:门户网站与广告效果分析
- 用友NC-V56供应链功能升级详解(84页)
- 计算机病毒与防御策略探索
- 企业网NAT技术实践:2022年部署互联网出口策略
- 软件测试面试必备:概念、原则与常见问题解析
- 2022年Windows IIS服务器内外网配置详解与Serv-U FTP服务器安装
- 中国联通:企业级ICT转型与创新实践
- C#图形图像编程深入解析:GDI+与多媒体应用
- Xilinx AXI Interconnect v2.1用户指南
- DIY编程电缆全攻略:接口类型与自制指南
- 电脑维护与硬盘数据恢复指南
- 计算机网络技术专业剖析:人才培养与改革
- 量化多因子指数增强策略:微观视角的实证分析
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功