this keyword
left of the dot
'This'는 값이 바운드되는 식별자입니다. 마치 변수와 같습니다. 'This'는 올바른 객체에 자동으로 바운드 됩니다. 인터프리터가 'This'에 올바른 바인딩을 하는 방법은 함수의 위치 매개 변수 규칙과 같습니다. 'This'가 위치 매개변수와 구별되는 점은 당신이 객체의 메소드나 생성자를 호출할때 어떤 오브젝트에 초점을 맞출 것인지 직관적인 도움을 주기 위함입니다.
package chattingJava; | |
import java.awt.*; | |
import java.io.*; | |
import java.awt.event.*; | |
public class WriteToFileEvent extends Frame implements ActionListener{ | |
Label lfile, ldata; | |
TextField tfile, tdata; | |
Button save; | |
String filename, data; |
this keyword
left of the dot
'This'는 값이 바운드되는 식별자입니다. 마치 변수와 같습니다. 'This'는 올바른 객체에 자동으로 바운드 됩니다. 인터프리터가 'This'에 올바른 바인딩을 하는 방법은 함수의 위치 매개 변수 규칙과 같습니다. 'This'가 위치 매개변수와 구별되는 점은 당신이 객체의 메소드나 생성자를 호출할때 어떤 오브젝트에 초점을 맞출 것인지 직관적인 도움을 주기 위함입니다.
closure
Every function should have access to all the variables from all the scopes that surraound it. a closure is just any function that somehow remains available after those outer scopes have returned
lexical Scope
var a = 1;
var b = function(){ //내부에서 외부 스코프의 변수 a참조 가능
public class LamportBakeryAlgorithm { | |
int sum; | |
boolean choosing[]; | |
int number[]; | |
int id; | |
public LamportBakeryAlgorithm() { | |
sum = 0; | |
choosing = new boolean [5]; | |
number = new int [5]; | |
id = -1; |
package javaTest; | |
public class test { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
DoubleThread t = new DoubleThread(); | |
Thread t1 = new Thread(t.new MyRunnableA("A")); | |
Thread t2 = new Thread(t.new MyRunnableB("B")); | |
t1.start(); |