ADM-201 dump PMP dumps pdf SSCP exam materials CBAP exam sample questions

《迪哥Java教程》#8 Java里的int类型 – 译学馆
未登陆,请登陆后再发表信息
最新评论 (0)
播放视频

《迪哥Java教程》#8 Java里的int类型

What you need to know about Java int primitives - 008

终于到了学习Java中如何用整型表示一个值的时候了
We’re finally going to look at how to represent values in Java using an integer.
这是Java中最常用的基本类型
This is the most commonly used Java primitive.
整型足以处理你使用的大部分数字
The integer is big enough to hold most numbers that you will use.
本节课的目的是学习int 类型
The goal for this lesson is to learn about the int data type,
它的大小 以及Java中如何创建它
it’s size, and how we create it in Java.
整型用32个比特位或四个字节表示
An integer is represented by 32 bits, or 4 bytes.
Java中用“int”这个关键字来声明整型
In Java we use the keyword int to declare
一个整型数字占4字节或32位
integers. An integer is 4 bytes, or 32 bits.
整型的取值范围大约在负二十亿和正二十亿之间
This is a number from approximately negative 2 billion to positive two billion.
准确值是2的31次方(视频有误不是32次方) 这个数有2GB那么大
The actual number is 2 to the power 31, but this number is large enough to just call it 2 gigabytes.
附注:32位操作系统 比如Windows
On a side note, 32 bit operating systems like Windows,
不会有超过4G的文件或存储器
can not have a file or memory larger than 4 GB.
这是因为计算机需要一个(地址)码来存储所有
This is because your computer needs one number for each possible addressable
可寻址的内存位置
memory location. There are only 4 billion
32位操作系统中只有40亿无符号的内存地址
unsigned possible locations on a 32 bit operating system.
即4GB 创建一个整型变量
So 4 gigabytes. To create an integer primitive
用“int”关键字 而不是“integer” 这是由C语言中衍化而来的 出于某些原因
we use the keyword int, not integer. This comes from C. For some reason, someone
有人认为
thought
integer太长了声明一个变量并赋值
integer was too long to type out. We give it a name, and possibly a value.
在这个例子中 我们随机挑一个数字
In this example, we’re using a number I picked out of a hat.
2763306 可以把它作为一个十进制的值
2,763,306. We can give the value as a decimal value,
二进制值 或十六进制 重新打开程序
binary value, or hexadecimal value. Open our program again.
我会添加这个 第一个例子是
I’ll add this. The first example is
十进制的字串 第二个是二进制字串
a decimal literal. The second is a binary literal.
第三个是十六进制字串
And the third is a hexadecimal literal.
运行 再来一次 返回值是十进制的
We run it, and again, the values are returned in decimal.
这是因为打印出来之前没有格式化
This is because we are not formatting the value when we print it back out.
这就是整型 当你处理任何关于整数的数学问题时
And that is the integer. When you’re doing any integer math,
这会是你想要用的类型
this is the type you’ll want to use.
没有比int更快速更高效的了
There is nothing faster or more efficient than the int.
下节课介绍Java中的长整型 long 型
Next we’ll cover the last integer primitive in Java. The long.
嘿!感谢收看
Hey! Thanks for watching the video.
如果你想测试这节课学的怎么样 DeegeU.com官网上有一个快速测试
It is a quick quiz for this on DeegeU.com if you’d like to gauge how much you learned.
如果你喜欢这个系列的视频 请为我点赞
If you like the videos you are seeing, please let me know by liking the video
并订阅youtube
and hitting the subscribe button for
的DeegeU频道 非常感谢
the DeegeU channel on YouTube. I’d really appreciate that!
如果你有任何疑惑或问题 请在下面或
If you have concerns or questions please leave them in the comments below or on
DeegeU.com官网的评论区去留言
DeegeU.com.
官网首页有一个投票
There’s a poll on the front pages of DeegeU.com
通过它来让我知道你们下节课想了解哪个主题
so you can let me know what topic is covered next.
感谢收看 下次再见
Thanks for watching and see you in the next video!

发表评论

译制信息
视频概述

讲解整型的取值范围,整型的大小,如何创建整型等

听录译者

收集自网络

翻译译者

谷子

审核员

知易行难

视频来源

https://www.youtube.com/watch?v=cO9S9hRkCL8

相关推荐