-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55518c2
commit 38ee099
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.betterzhang.learnkotlin.java; | ||
|
||
/** | ||
* Created by IntelliJ IDEA. | ||
* Author : Andrew Zhang | ||
* Email : betterzhang.dev@gmail.com | ||
* Time : 2017/06/28 下午 1:12 | ||
* Desc : description | ||
*/ | ||
public final class Wrapper<T> { | ||
|
||
private T item; | ||
|
||
public Wrapper(T item) { | ||
this.item = item; | ||
} | ||
|
||
public T getItem() { | ||
return item; | ||
} | ||
|
||
public static void main(String[] args) { | ||
Wrapper<String> wrapper = new Wrapper<>("Hello Java"); | ||
System.out.println(wrapper.getItem()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.betterzhang.learnkotlin.kotlin | ||
|
||
/** | ||
* Created by IntelliJ IDEA. | ||
* Author : Andrew Zhang | ||
* Email : betterzhang.dev@gmail.com | ||
* Time : 2017/06/28 下午 1:18 | ||
* Desc : description | ||
*/ | ||
class Wrapper<T>(val item: T) | ||
|
||
fun main(args: Array<String>) { | ||
var wrapper = Wrapper("Hello Kotlin") | ||
println(wrapper.item) | ||
} |