Some notes in Stanford CS106A(1)
Karel world
1.During make a divider operation
--int x=5; double y = x/2 => y=2
we need sth as a double for the purpose of this operation treat it as though it were a double .
--int x=5; double y = (double)x/2 => y=2.5
OR
--int x=5; double y = x/2.0 => y=2.5
2.Define a const that can't be changed
private static final doule PI=3.14;
final:the value won't change after I give its initial value,
static:there's only one of these for the entire class,
private: it only lives inisde the class.
3.A buggy in boolean
boolean p = (x !=1) || (x!=2)
=>correct is : boolean p = (x !=1) && (x!=2)
4.Scope: lifetime of variable
5.While cast sth that lose information , like from double to a integer , you have to put in the CAST.
ex. double y = 3.5; int x = (int) y;
(if doesn't lose information like int to double , you dont have to cast.)
6.For versus while
For loop used for definite iteration(Generally we know how many times we want to iterate)
While loop used for indefinate iteration(Generally don't know how many times to iterate beforehand.)
Some notes in Stanford CS106A(1)的更多相关文章
- Some notes in Stanford CS106A(4)
1.x++ is a method , the return value is x. (post increment) ++x is also a method , the return value ...
- Some notes in Stanford CS106A(3)
1.If ( str1==str2 ) means if str1 and str2 are refers to the same OBJECT. But when compare string , ...
- Some notes in Stanford CS106A(2)
1.Local variable(local) ex. int i = 0; factorial(i); the "i" outside the method factorial( ...
- Lotus Notes中编程发送邮件(二)
在编程发送各种类似通知的邮件时,时常会需要发件人显示为某个特定的帐户,比如某个部门的名称或者管理员的名字.另一种需求是,用户收到某封邮件后,回复邮件的地址不同于发件人栏显示的地址.而正常情况下,发送邮 ...
- 46. Lotus Notes中编程发送邮件(一)
邮件是Lotus Notes体系的核心和基本功能,以至于Send()是NotesDocument的一个方法,任何一个文档都可以被发送出去,Notes里的一封邮件也只是一个有一些特殊字段的文档.在程序开 ...
- Stanford NLP学习笔记:7. 情感分析(Sentiment)
1. 什么是情感分析(别名:观点提取,主题分析,情感挖掘...) 应用: 1)正面VS负面的影评(影片分类问题) 2)产品/品牌评价: Google产品搜索 3)twitter情感预测股票市场行情/消 ...
- Machine Learning Algorithms Study Notes(4)—无监督学习(unsupervised learning)
1 Unsupervised Learning 1.1 k-means clustering algorithm 1.1.1 算法思想 1.1.2 k-means的不足之处 1 ...
- 84. 从视图索引说Notes数据库(下)
作用和代价上文介绍了关系型数据库里的索引.Notes数据库里的索引隐藏在视图概念里(本文的讨论仅仅针对Notes的视图索引,不包括全文索引.).开发者创建的视图仅仅是存放在数据库里的一条设计文档.数据 ...
- 83. 从视图索引说Notes数据库(上)
索引是数据库系统重要的feature,不管是传统的关系型数据库还是时兴的NoSQL数据库,它攸关查询性能,因而在设计数据库时须要细加考量.然而,Lotus Notes隐藏技术底层.以用户界面为导向.追 ...
随机推荐
- c++连续读取未知个数的数字
#include <iostream> using namespace std; int main() { int n; ]; ,count=; while(cin>>n){ ...
- 学习node.js的一些笔记
最近看了几眼node.js,以前曾听说它用途很大. 在菜鸟教程上,已看了过半的内容:http://www.runoob.com/nodejs/nodejs-web-module.html,如今看到了这 ...
- Dynamic CRM插件调试与单元测试
背景 使用Dynamic CRM平台开发完业务插件后,不可避免的就是进行插件调试,测试插件是否正常运行,网上关于Dynamic CRM的资料比较少,但对于调试的博客还是挺多的,足可见插件调试对于Dyn ...
- 【论文速读】Multi-Oriented Scene Text Detection via Corner Localization and Region Segmentation[2018-CPVR]
方法概述 该方法用一个端到端网络完成文字检测整个过程——除了基础卷积网络(backbone)外,包括两个并行分支和一个后处理.第一个分支是通过一个DSSD网络进行角点检测来提取候选文字区域,第二个分支 ...
- Linux下手动编译shogun
手动编译shogun,如果按照直接按照官网上的步骤进行,会踩非常多的坑,下面分享一下在下的编译过程,希望能为阁下提供些许借鉴. 1. git clone https://github.com/shog ...
- springboot 多端口启动
以eclipse(STS)为例, 选中项目右键Run Configurations 点击Spring Boot App,选中需要设定多端口项目,在启动参数一栏输入:-Dserver.port=7003 ...
- react-redux-数据流
redux是严格的单向数据流 1,store.dispatch(action) 2, reducer(previousState, action), reducer是纯函数.它仅仅用于计算下一个 st ...
- 【转载】Druid 介绍及配置
原文链接:https://www.cnblogs.com/niejunlei/p/5977895.html 1. Druid是什么? Druid是Java语言中最好的数据库连接池.Druid能够提供强 ...
- git冲突解决的几种办法
文章目录 git stash 栈 放弃本地修改 撤销分支 强行冲掉之前的分支 删除分支 git stash 栈 git stash git pull git stash pop 当pull出现冲突时 ...
- SVN分支与合并【超详细的图文教程】(转载)
SVN分支与合并 一. 分支与合并的概念 二. SVN分支的意义 三. 如何创建分支与合并分支 一.分支与合并的概念: 分支:版本控制系统的一个特性是能够把各种修改分离出来放在开发品的一个分割线上.这 ...