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都很好,非常 ...
随机推荐
- Centos7中使用ipset
1.禁用firewalld systemctl stop firewalld systemctl disable firewalld 2.安装ipset yum -y install ipse ...
- '0','\0',NULL,EOF的区别
要看是不是一个东西,打印一下即可 printf("%d %d %d %d\n",'0','\0',NULL,EOF); 输出: 48 0 0 -1 结论: '\0'与NULL 都是 ...
- python---Scrapy模块的使用(一)
Scrapy是一个为了爬取网站数据,提取结构性数据而编写的应用框架. 其可以应用在数据挖掘,信息处理或存储历史数据等一系列的程序中. Scrapy 使用了 Twisted异步网络库来处理网络通讯.整体 ...
- HTML5-Y音频与视频
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- CF821 B. Okabe and Banana Trees 简单数学
Link 题意:给出一条直线,在直线上取一点,其垂直x,y轴作成一个,求矩阵中所有包含的点的x,y坐标之和的最大值. 思路:对于一个任意一点我们计算公式,对于任意一点$(x, y)$,有$(x+y)^ ...
- SPOJ DQUERY 离线树状数组+离散化
LINK 题意:给出$(n <= 30000)$个数,$q <= 2e5$个查询,每个查询要求给出$[l,r]$内不同元素的个数 思路:这题可用主席树查询历史版本的方法做,感觉这个比较容易 ...
- Python学习笔记(五十)爬虫的自我修养(三)爬取漂亮妹纸图
import random import urllib from urllib import request import os ################################### ...
- 可编辑表格(Editable Table)
需求分析 1.单击table的每个cell后,给cell加上一个尺寸相当的input; 2.input后把value传给cell的innerHTML; 3.失焦后删除input. HTML <! ...
- Cloudera 安装
参考网址: http://tcxiang.iteye.com/blog/2087597 http://archive.cloudera.com/cdh5/ http://archive.clouder ...
- bzoj3524/2223 [Poi2014]Couriers
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3524 http://www.lydsy.com/JudgeOnline/problem.ph ...