티스토리 뷰
JamesThread.java
package com.jwsoft.javaproject;
import android.util.Log;
public class JamesThread extends Thread {
@Override
public void run() {
super.run();
Log.e("NickName : ", "혀가 길지 않은 개발자");
showLastName();
showFirstName();
}
public void showLastName() {
Log.e("LastName : ", "Kim");
}
public void showFirstName() {
Log.e("FirstName : ", "James");
}
}
MainActivity.java
package com.jwsoft.javaproject;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.e("", "Thread START");
JamesThread jamesThread = new JamesThread();
jamesThread.start();
Log.e("", "Thread END");
}
}
MainActivity.java
package com.jwsoft.javaproject;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.e("", "Thread START");
JamesThread jamesThread = new JamesThread();
jamesThread.start();
try {
jamesThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
Log.e("", "Thread END");
}
}
jamesThread.join() 추가
'Android > Java' 카테고리의 다른 글
[Java] import com.google.gson.* (0) | 2020.07.31 |
---|---|
[Java] import org.json.* (0) | 2020.07.30 |
[Java] Synchronized (0) | 2020.07.27 |
[Java] Generics (0) | 2020.07.24 |
[Java] MVVM (0) | 2020.07.23 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 코틀린
- Vue.js #Vue.js + javascript
- Livedata
- recyclerview
- Android
- ViewPager2
- java
- Architecture Pattern
- JSONArray
- Design Pattern
- MVVM
- Kotlin
- Intent
- 안드로이드 #코틀린 #Android #Kotlin
- 안드로이드
- View
- 혀가 길지 않은 개발자
- James Kim
- ViewModel
- 자바
- JSONObject
- XML
- handler
- activity
- coroutine
- ArrayList
- DataBinding
- TabLayout
- CoordinatorLayout
- fragment
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함