2017年4月3日 星期一

Java

argument:引數(實際的值)
parameter:參數(代表該值的符號)
https://msdn.microsoft.com/zh-tw/library/9kewt1b3.aspx




Byte-Code:一種給JVM跑的低階語言

Interpreter:直譯器


Javac is Java Compiler -- Compiles your Java code into Bytecode
JVM is Java Virtual Machine -- Runs/ Interprets/ translates Bytecode into Native Machine Code
JIT is Just In Time Compiler -- Compiles the given bytecode instruction sequence to machine code at runtime before executing it natively. It's main purpose is to do heavy optimizations in performance.
So now, Let's find answers to your questions..
1)JVM: is it a compiler or an interpreter? -- Ans: Interpreter
2)what about JIT compiler that exist inside the JVM? -- Ans: If you read this reply completly, you probably know it now
3)what exactly is the JVM? -- Ans:
  • JVM is a virtual platform that resides on your RAM
  • Its component, Class loader loads the .class file into the RAM
  • The Byte code Verifier component in JVM checks if there are any access restriction violations in your code. (This is one of the principle reasons why java is secure)
  • Next, the Execution Engine component converts the Bytecode into executable machine code
http://stackoverflow.com/questions/7674839/is-the-jvm-a-compiler-or-an-interpreter



Object code:


dynamic compile



What is Class Loader:
http://stackoverflow.com/questions/2424604/what-is-a-java-classloader


Syntax:語法
Semantics:語意


Errors:

  1. Syntax error(編譯時發現)
  2. Run-time error(編譯時無法發現,執行時發現)
  3. Logic error(編譯與執行時無法發現,但程式無法如願完成目的)

Identifier:被定義的項目名稱

Rules
1. The only allowed characters in java identifiers are a to z, A to Z, 0 to 9, $ and _(Underscore). If we are using any other character then we will get compilation error.
2. Identifiers can't start with digit i.e., 123name is not valid.
3. Java identifiers are case sensitive of course java language itself considered as case sensitive programming language. i.e., name, Name, NAME both are different variable names.
4. There is no length limit for java identifiers but it is not recommended to take too length identifiers.
5. We can't use keywords(關鍵字) and reserved words(保留字) as identifiers otherwise we will get compilation error. i.e., int if = 20; here we will get compilation error.
6. All predefined java class names and interface names we can use as identifiers. 
i.e., int String = 20;  int System = 20; int println = 20; 
here we won't get any compilation error. But it is not a good programming practice.


https://www.quora.com/What-is-an-identifier-in-Java

命名慣例:

  1. variables, classes, methods, and objects: 開頭小寫,中間有單字的話字首大寫,其他小寫或數字。例:topSpeed, bankRate1, timeOfArrival
  2. classes:開頭改為大寫。例:MyClass


matlab

nargin:
https://www.ptt.cc/bbs/MATLAB/M.1176262377.A.7C0.html