-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.java
More file actions
executable file
·49 lines (38 loc) · 880 Bytes
/
Copy pathApp.java
File metadata and controls
executable file
·49 lines (38 loc) · 880 Bytes
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.coreJava;
import java.util.List;
import java.util.Optional;
public final class App {
private App() {
}
public static void main(String[] args) {
System.out.println(" Hello World!!!!!!! ");
App a = new App();
a.summer(1, 20);
}
void summer(long a, int b) {
System.out.println("Int ");
}
// void sum ( int a , long b ){ System.out.println("Long ");} // Ambigous error
}
/*
* Reduce Null As much as you can
*
* }
*
* for returning Simple String/Integer ; use Optional
* eg
*/
class SampleClass {
/* Reduce Null As much as you can */
public List<String> returnSampleList() {
return List.of(); // use This , instead of return null ;
}
/* For String/Integer */
public String returnSampleString() {
return null;
}
// instead use
public Optional<String> returnStrng() {
return Optional.empty();
}
}