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)的更多相关文章

  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 ...

  2. 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 , ...

  3. Some notes in Stanford CS106A(2)

    1.Local variable(local) ex. int i = 0; factorial(i); the "i" outside the method factorial( ...

  4. Lotus Notes中编程发送邮件(二)

    在编程发送各种类似通知的邮件时,时常会需要发件人显示为某个特定的帐户,比如某个部门的名称或者管理员的名字.另一种需求是,用户收到某封邮件后,回复邮件的地址不同于发件人栏显示的地址.而正常情况下,发送邮 ...

  5. 46. Lotus Notes中编程发送邮件(一)

    邮件是Lotus Notes体系的核心和基本功能,以至于Send()是NotesDocument的一个方法,任何一个文档都可以被发送出去,Notes里的一封邮件也只是一个有一些特殊字段的文档.在程序开 ...

  6. Stanford NLP学习笔记:7. 情感分析(Sentiment)

    1. 什么是情感分析(别名:观点提取,主题分析,情感挖掘...) 应用: 1)正面VS负面的影评(影片分类问题) 2)产品/品牌评价: Google产品搜索 3)twitter情感预测股票市场行情/消 ...

  7. 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 ...

  8. 84. 从视图索引说Notes数据库(下)

    作用和代价上文介绍了关系型数据库里的索引.Notes数据库里的索引隐藏在视图概念里(本文的讨论仅仅针对Notes的视图索引,不包括全文索引.).开发者创建的视图仅仅是存放在数据库里的一条设计文档.数据 ...

  9. 83. 从视图索引说Notes数据库(上)

    索引是数据库系统重要的feature,不管是传统的关系型数据库还是时兴的NoSQL数据库,它攸关查询性能,因而在设计数据库时须要细加考量.然而,Lotus Notes隐藏技术底层.以用户界面为导向.追 ...

随机推荐

  1. C#操作MySQL的类

    C#操作MySQL的类 public class MySqlService { private static log4net.ILog logger = log4net.LogManager.GetL ...

  2. Robot Framework--Selenium2Library库3

    1.介绍 Selenium 自动化测试工具,它主要是用于 Web 应用程序的自动化测试,但并不只局限于此,同时支持所有基于 web 的管理任务自动化.Selenium 的特点: 开源,免费 多浏览 ...

  3. Kotlin 使用类似C# 的yield功能

    用过c#的可能对 yield 关键字爱不释手,那么在像我这种被迫上java贼船的人,就想找到类似的功能. 我使用的是kotlin,下面的方法演示了产生一个序列的功能. val fibonacciSeq ...

  4. java8 简便的map和list操作

    如果你看到这篇文章,说明你对java繁琐的list和map操作产生了厌烦.在java中,频繁的操作基本上是获取到对象list,然后根据某个属性或者某几个属性的值,把list转为map,然后遍历其他对象 ...

  5. day 11 装饰器

    1.day 10 内容复习 # 之前做得的题 以后再遇到能保证会 # 下周二考 :所有的知识 # 面试题:认真对待 # # 三元运算符 # 接收结果的变量 = 条件为真的结果 if 条件 else 条 ...

  6. shell脚本学习之实例列举

    1.用shell写一个从1加到100的程序: 方法一: #!/bin/bashsum=0for i in {1..100}do   let sum+=$idone   echo $sum 方法二: # ...

  7. 安装vue 教程

    安装教程:https://www.cnblogs.com/zhaomeizi/p/8483597.html

  8. flask基础---第三篇

    flask中request的一些方法 首先from flask import request 1.request.path 2.request.host 3.request.host_url from ...

  9. 微信小程序上传图片

    话不多说,直接上码. <view class="section"> <!--放一张图片或按钮 点击时去选择图片--> <image class='ph ...

  10. Vue组件化应用构建 官网例子 Unknown custom element: <todo-item>

     [博客园cnblogs笔者m-yb原创,转载请加本文博客链接,笔者github: https://github.com/mayangbo666,公众号aandb7,QQ群927113708] htt ...