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都很好,非常 ...
随机推荐
- 运行python时提示:ImportError: No module named plyvel ,ImportError No module named irc 解决过程:
(当前python版本:2.7) 1.在git下载electrum-server: cd / git clone https://github.com/spesmilo/electrum-server ...
- jquery validate submitHandler 提交导致死循环
dom对像的提交form.submit();和jquery对像的提交$('').submit();功能上是没有什么区别的.但是如果用了jquery validate插件,提交时这二个就区别大了.$(' ...
- LeetCode-Sort List[AC源码]
package com.lw.leet4; /** * @ClassName:Solution * @Description: * Sort List * Sort a linked list in ...
- background(css复合写法)
1. 背景-background========================================================== 单个属性的写法 .sample1 { /*背景颜色 ...
- hdu 4940 Destroy Transportation system (无源汇上下界可行流)
Destroy Transportation system Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 ...
- [洛谷P2750] [USACO5.5]贰五语言Two Five
洛谷题目链接:[USACO5.5]贰五语言Two Five 题目描述 有一种奇怪的语言叫做"贰五语言".它的每个单词都由A-Y这25个字母各一个组成.但是,并不是任何一种排列都是一 ...
- 关于拉格朗日乘子法与KKT条件
关于拉格朗日乘子法与KKT条件 关于拉格朗日乘子法与KKT条件 目录 拉格朗日乘子法的数学基础 共轭函数 拉格朗日函数 拉格朗日对偶函数 目标函数最优值的下界 拉格朗日对偶函数与共轭函数的联系 拉 ...
- vue-loader 调用了cssLoaders方法配置了css加载器属性。
module: { loaders: [ // 这里也是相应的配置,test就是匹配文件,loader是加载器, { test: /\.vue$/, loader: 'vue' }, { test: ...
- Java错误提示:Syntax error, insert "}" to complete Block
从网上复制了一段java代码到Eclipse里面,调整了一下格式,把Eclipse提示的明显有问题的地方,主要是空格,删掉了,但还是在最后一个分号那里提示“Syntax error, insert & ...
- 16 - 文件操作-StringIO-BytesIO
目录 1 文件操作 1.1 open函数介绍 1.2 打开操作 1.2.1 mode模式 1.2.2 文件指针 1.2.3 缓冲区 1.2.4 encoding编码 1.2.5 其他参数 1.3 读写 ...