Java Programs
Java Programs
Fibonacci series in Java
public class FibonacciExample {
public static void main(String[] args) {
int n1 = 0, n2 = 1, n3, count = 15;
System.out.print(n1 + " " + n2);
for (int i = 2; i < count; i++) {
n3 = n1 + n2;
n1 = n2;
n2 = n3;
System.out.print(" " + n3);
}
}
}
运行结果
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377
参考资料
Java Programs的更多相关文章
- Thinking in Java——笔记(18)
I/O The original byte-oriented library was supplemented with char-oriented, Unicode-based I/O classe ...
- Java性能提示(全)
http://www.onjava.com/pub/a/onjava/2001/05/30/optimization.htmlComparing the performance of LinkedLi ...
- Java Garbage Collection Basics--转载
原文地址:http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html Overview Purpose ...
- JAVA fundamentals of exception handling mechanism
Agenda Three Categories Of Exceptions Exceptions Hierarchy try-catch-finally block The try-with-reso ...
- Core Java Volume I — 3.3. Data Types
3.3. Data TypesJava is a strongly typed language(强类型语音). This means that every variable must have a ...
- Core Java Volume I — 3.1. A Simple Java Program
Let’s look more closely at one of the simplest Java programs you can have—one that simply prints a m ...
- Java常用类:String
一.介绍 String:不可变的Unicode字符序列 例如:"Java" 就是4个Unicode字符J,a,v,a组成的 Java没有内置的字符串类型,而是在标准的J ...
- Java String Class Example--reference
reference:http://examples.javacodegeeks.com/core-java/lang/string/java-string-class-example/ 1. Intr ...
- Getting Started with Java
“学前”说明:<Learn Java for Android>这本书内容很多,都是精华,建议大家看英文版的.在这里我不打算一一总结书中的内容,书中每章节后面的exercises都很好,非常 ...
随机推荐
- bzoj 3834 [Poi2014]Solar Panels 数论分块
3834: [Poi2014]Solar Panels Time Limit: 20 Sec Memory Limit: 128 MBSubmit: 367 Solved: 285[Submit] ...
- shizhong
<script charset="Shift_JIS" src="http://chabudai.sakura.ne.jp/blogparts/honehonecl ...
- python shell
os.system(cmd) 命令执行结果 0或者1 output = os.popen(cmd) print output.read() 通过 os.popen() 返回的是 file read 的 ...
- nova-api源码分析(APP中用到的开源库)
源码版本:H版 1.paste.deploy 参考文章: http://pythonpaste.org/deploy/ http://blog.csdn.net/xiangmin2587/articl ...
- [DeeplearningAI笔记]卷积神经网络2.5-2.7 Network in Network/1*1卷积/Inception网络/GoogleNet
4.2深度卷积网络 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考文献 Inception网络 --Szegedy C, Liu W, Jia Y, et al. Going deepe ...
- OpenCV---模糊操作
推文:图像平滑处理(归一化块滤波.高斯滤波.中值滤波.双边滤波) 推文:图像的平滑与滤波 模糊操作 三种模糊操作方式 均值模糊 中值模糊 自定义模糊(可以实现上面两种模糊方式) 原理: 图像处理:基础 ...
- 图论&搜索:K短路-启发式搜索
判断第k短路的权值是否小于T 直接把队友的代码拿过来了,一定很经典 #include <iostream> #include <queue> #include <cstr ...
- HDU 2138 Miller-Rabin 模板题
求素数个数. /** @Date : 2017-09-18 23:05:15 * @FileName: HDU 2138 miller-rabin 模板.cpp * @Platform: Window ...
- FTP、SFTP文件下载内容校验
描述: 从FTP.SFTP下载的文件做MD5码校验,文件名和MD5码值存放在表格里,表格位置在FTP.SFTP服务器上. os模块只能遍历本地目录/文件,需要先连接FTP.SFTP服务器,将表格下载到 ...
- TCP和UDP相关概念
位于传输层的协议,都是基于IP协议的. TCP是面向连接的.可靠的传输,UDP是无连接的.不可靠的传输.要进行TCp传输时候,需要进行三次握手,建立连接,然后才能发送数据,而且在发送过程中,有数据的确 ...