10 lines
723 B
Text
10 lines
723 B
Text
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Greet</span> </span>{
|
|
<span class="hljs-function"><span class="hljs-keyword">public</span> Either<Integer, String> <span class="hljs-title">f</span><span class="hljs-params">(<span class="hljs-keyword">int</span> val)</span> </span>{
|
|
<span class="hljs-keyword">new</span> Type();
|
|
<span class="hljs-keyword">if</span> (val) {
|
|
<span class="hljs-keyword">return</span> getType();
|
|
} <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (!val) {
|
|
<span class="hljs-keyword">throw</span> getError();
|
|
}
|
|
}
|
|
}
|