<파일 입출력>


File 클래스 메소드


boolean

createNewFile()

새로운 파일 생성

boolean

mkdir()

새로운 디렉토리(폴더) 생성

boolean

mkdirs()

경로상에 없는 모든 디렉토리 생성

boolean

delete()

파일 or 디렉토리 삭제


figure out


1) to understand or solve something


2) to calculate an amount



You can figure it out. 

너 해결할 수 있어.


I just can't figure out why.    (Rihanna - We ride 노래 中)

난 도저히 이유를 알 수가 없어.

'me myself and i > english' 카테고리의 다른 글

담당 부서를 가르쳐 주세요  (0) 2018.03.28
영어회화 100일의 기적 - 2일차  (2) 2018.03.27
영어회화 100일의 기적 - 1일차  (0) 2018.03.25
다 잘 될거야  (0) 2018.01.09
Just give up. 포기해!  (0) 2018.01.08

이런식으로 리턴값을 선언할 수도 있다.





package study;


public class CalculatorExample {

public static void main(String[] args) {


double result1 = 10 * 10 * Calculator2.pi;

int result2 = Calculator2.plus(10, 5);

int result3 = Calculator2.minus(10, 5);

System.out.println("result1 : " + result1);

System.out.println("result2 : " + result2);

System.out.println("result3 : " + result3);

}

}



class Calculator2 {

static double pi = 3.14159; 

static int plus(int x, int y)

{

return x + y;

}

static int minus(int x, int y)

{

return x - y;

}

}




(콘솔)

result1 : 314.159

result2 : 15

result3 : 5



return은 함수가 결과물을 반환한다는 뜻이고, 반환 하는 순간 함수는 종료된다. (지금 동작하는 구문을 빠져나가는 것)

return값이 없으면 void 메소드를 사용한다.

매개변수가 있으면 호출시에도 매개변수 값 입력해야 한다.





package study;


public class CalculatorExample {

public static void main(String[] args) {


Calculator myCalc = new Calculator();

myCalc.powerOn();

int result1 = myCalc.plus(5, 6);

System.out.println("result1 : " + result1);

byte x = 10;

byte y = 4;

double result2 = myCalc.divide(x, y);

System.out.println("result2 : " + result2);

myCalc.powerOff();

}

}



class Calculator {

//메소드

void powerOn() //리턴값x

{

System.out.println("전원을 켭니다.");

}

int plus(int x, int y)

{

int result = x + y;

return result; //리턴값o

}

 

double divide(int x, int y)

{

double result = (double)x / (double)y;

return result;

}

void powerOff()

{

System.out.println("전원을 끕니다.");

}

}






(콘솔)

전원을 켭니다.

result1 : 11

result2 : 2.5

전원을 끕니다.





To solve this problem, erase forder /.gradle and reopen Android stuido.



컴퓨터 성능이 안좋아서인지는 모르겠지만, 안드로이드 스튜디오를 설치해서 에뮬레이터 돌리기 까지가 너무 험난하다.

며칠 째 안되고 있는 중이라서 지식인이랑 카페에 질문하면서 수정해가는 중이다.

참 뭔가를 세팅할 때마다 시간 많이 잡아먹는 것 같다.


프로젝트를 삭제한 다음에 안드로이드 스튜디오를 껐다가 다시 시작하라고 한다. 


해봤는데 해결이 안 된다.






If you didn't solve this problem, then select File - Invalidate Cashes / Restart.. and Invalidate and Restart


위 사진같이 클릭해보는 방법도 있다고 한다.

하지만 역시 안된다.





Or close all projects(File - Close Project), and create a new project.


다음은 모든 프로젝트를 File - Close Project를 통해서 닫고

프로젝트 이름을 바꿔서 새로운 프로젝트로 실행시키는 방법이다.


이렇게 하니깐 Activity 설정하는데에서 더 넘어가지 않고 막혀버렸다.



프로그램을 지우고 차근차근 다시 깔아봐야겠다.




+ Recent posts