Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Java Functional Programming
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; class Rextester { static String name = "Andrey Sotnikov"; static String dob = "02/07/1984"; static void print(String param) { System.out.println(param); } static long age(String param_dob) throws ParseException { SimpleDateFormat f = new SimpleDateFormat("MM/dd/yyyy"); Date date =f.parse(param_dob); long dob_ms = date.getTime(); long now_ms = System.currentTimeMillis(); return (now_ms - dob_ms) / 31_556_952_000L; } public static void main(String[] args) throws ParseException{ print("Name: " + name + ". Age: " + age(dob)); } }
run
|
edit
|
history
|
help
0
Armstrong number
JAVA # Günlük Maaş Hesaplama
Java Course
Smallest Multiple of N with Zeros and Ones
LRU cache - Simple solution (costly)
2b
Star
true false
LCM of 2 numbers
2(B).