Programming/Java2014. 3. 11. 17:07
java에서 class 에 접근제한을 하지 않고 (ex. public class) 생성시에는
동일 패키지에 대해서만 접근이 가능하도록 생성이 된다.

[링크 : http://stackoverflow.com/questions/16164902/what-is-the-default-access-modifier-in-java]

 A class may be declared with the modifier public, in which case that class is visible to all classes everywhere. If a class has no modifier (the default, also known as package-private), it is visible only within its own package (packages are named groups of related classes — you will learn about them in a later lesson.)
 

[링크 : http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html


public > protected > default > private
public - 전부 허용
protected - 동일 패키지, 상속관계시 허용
default - 동일 패키지, 전부 허용
private - 현재 class / object만 허용

'Programming > Java' 카테고리의 다른 글

java 1.5 이후 추가 for-each / varargs(autoboxing)  (0) 2014.03.11
JUnit 사용 예  (0) 2014.03.11
*.java 파일 하나에 여러개의 class 생성  (0) 2014.03.11
java 명령어 줄 인수  (0) 2014.03.10
java break / continue  (0) 2014.03.10
Posted by 구차니
Programming/Java2014. 3. 11. 17:01
하나의 파일에 여러개의 class를 추가할수 있으나
파일명과 동일한 클래스는 반드시 public 이어야 한다.
그리고 동일 파일내에 다른 클래스들 역시 독립된 *.class 파일로 생성된다.

[링크 : https://kldp.org/node/69225]
[링크 : http://k.daum.net/qna/view.html?qid=3fqBg]

'Programming > Java' 카테고리의 다른 글

JUnit 사용 예  (0) 2014.03.11
java class default access modifier  (0) 2014.03.11
java 명령어 줄 인수  (0) 2014.03.10
java break / continue  (0) 2014.03.10
java와 cpp의 차이점 - 연산자 오버로딩 / 다중상속  (0) 2014.03.10
Posted by 구차니
Programming/C Win32 MFC2014. 3. 11. 16:30
gcc의 확장 기능으로
형의 종류를 알려준다고 하는데.. c++용인지 c용인지 모르겠다 -_-

[링크 : http://stackoverflow.com/questions/12081502/typeof-operator-in-c]
[링크 : http://codecat.tistory.com/entry/GCC-typeof]

If you are writing a header file that must work when included in ISO C programs, write __typeof__ instead of typeof.

[링크 : http://gcc.gnu.org/onlinedocs/gcc/Typeof.html
[링크 : http://en.wikipedia.org/wiki/Typeof]
[링크 : http://en.wikipedia.org/wiki/Typeid]

'Programming > C Win32 MFC' 카테고리의 다른 글

순열생성관련  (0) 2014.06.27
2중 포인터 사용이유  (0) 2014.03.19
const / pointer  (0) 2014.02.25
assert()  (0) 2013.12.18
printf의 %s와 %S  (0) 2013.06.15
Posted by 구차니
Microsoft/Windows2014. 3. 11. 12:26
간만에 노트북 켜니 이런게 뜨네?
정말 이렇게 XP는 역사의 뒤안길로 사라질.... 리가 있나 -_-


'Microsoft > Windows' 카테고리의 다른 글

윈도우 업데이트 백업 삭제하기  (2) 2014.05.04
win7 로컬설치를 vhd로 옮기기  (0) 2014.04.29
vhd 용량 늘리기  (0) 2014.02.03
vhd 관련 링크 모음  (0) 2014.01.29
vhd extendable과 fixed의 차이점?  (0) 2013.10.27
Posted by 구차니
왜!? 할인이니까!

 

'게임 > 오리진&스팀&유플레이' 카테고리의 다른 글

오리진이 나에게 게임을 주었어 - 식좀  (0) 2014.05.17
MDK 할인!  (0) 2014.03.19
간만에 지름!! 험블번들 X  (1) 2014.01.16
간만에 게임 목록  (0) 2013.12.29
스팀 연말 할인 시작!!  (0) 2013.12.22
Posted by 구차니
프로그램 사용/eclipse2014. 3. 10. 18:26
netbeans의 JFC 디자이너 같은게 있다길래 검색 궈궈싱
"Eclipse Marketplace"나 "Install New Software"를 통해 설치가 가능하다.



[링크 : http://www.eclipse.org/windowbuilder/]
[링크 : http://wiki.eclipse.org/Visual_Editor_Project] VEP no longer active



[링크 : http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.wb.doc.user%2Fhtml%2Findex.html]

'프로그램 사용 > eclipse' 카테고리의 다른 글

eclipse JRE 설정하기  (0) 2014.03.20
eclipse command argument 가 이상해!  (2) 2014.03.13
eclipse JDT + javadoc  (0) 2014.03.10
eclipse auto indent  (0) 2014.03.07
eclipse jdt / cdt - 문법강조 변경하기  (0) 2012.01.29
Posted by 구차니
프로그램 사용/eclipse2014. 3. 10. 18:13
JDK를 설치했다면
eclipse에서 간단히 javadoc을 생성할 수 있다.

Project - Generate JavaDoc


Javadoc command에는 javadoc 명령어의 위치를 넣어주면 된다.
귀찮으면 걍  finish 누르면 알아서 생성된다. 


[링크 : http://dev.plusblog.co.kr/6]

alt-shift-j 를 통해서 javadoc용 주석을 간편히 넣을 수 있다.


아래가 자동생성된 javadoc 주석


[링크 : http://stackoverflow.com/questions/1777175/how-can-i-generate-javadoc-comments-in-eclipse]
Posted by 구차니
Programming/Java2014. 3. 10. 17:09
java는 파일명이 클래스명과 동일해야 하므로
c와 같이 인자 0번이 실행된 파일의 이름이 아니라 첫번째 인자가 들어온다.

public class test {

public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(args.length);
for(int i = 0; i < args.length;i++)
System.out.println(args[i]);
}
}

일반적으로 많이 쓰일 문자열 인자를 숫자로 바꾸어주는 parse 관련 클래스/메소드들
Char 클래스는 존재하지 않나? 
Double.parseDouble();
Float.parseFloat();
Boolean.parseBoolean();
Byte.parseByte();
Short.parseShort();
Integer.parseInt(s);
Long.parseLong(); 

[링크 : http://docs.oracle.com/javase/tutorial/essential/environment/cmdLineArgs.html]
Posted by 구차니
Programming/Java2014. 3. 10. 16:32
java에서는 goto가 없지만 break와 continue에 label을 지원한다.
[링크 : http://stackoverflow.com/questions/2545103/is-there-a-goto-statement-in-java]

 The break statement terminates the labeled statement; it does not transfer the flow of control to the label. Control flow is transferred to the statement immediately following the labeled (terminated) statement.

[링크 : http://stackoverflow.com/questions/14960419/is-using-a-labeled-break-a-good-practice-in-java

단, 반복문과 라벨 사이에는 어떠한 문장도 들어가서는 안되며 무언가가 삽입되었을 시에는
"The label -label name- is missing"이라는 에러가 발생된다.


[링크 : http://docs.oracle.com/javase/tutorial/java/nutsandbolts/branch.html]
Posted by 구차니
Programming/Java2014. 3. 10. 13:10
연산자 오버로딩 / 다중 상속을
cpp는  허용
자바는 허용하지 않는다.


다중상속의 경우 다중상속시 상속했던 클래스들을 모두 알아야 하기에 정보 은닉 및 캡슐화에 치명적이고
(결국 볼게 더 많아진 c 일뿐 유지 보수 측면에서)

연산자 오버로딩은 변형이 심하게 될 경우 파악해야할 부분이 많이 늘어나기에 가독성이 떨어져서 이래저래 빼버린듯 하다.
(극단적으로 클래스에 대한 operator[] 를 전혀 다르게 정의해서 사용한다면
배열로 사용할 수 없지만 해석하는 사람으로서는 혼동할 수 밖에 없다.)

'Programming > Java' 카테고리의 다른 글

java 명령어 줄 인수  (0) 2014.03.10
java break / continue  (0) 2014.03.10
java explicit upcasting 묵시적 형변환  (0) 2014.03.07
java byte 형의 오묘함  (0) 2014.03.07
java primitive data type + 연산자  (0) 2014.03.07
Posted by 구차니