I want to add 5 seconds to current time
Date date = new Date();
date.setSeconds(date.getSeconds()+ 5);
System.out.println(\"old Value is: \"+date);
deprecated
means that this method should't be used anymore because it can be removed from the Java language in favor of some other method (it probably won't be removed but it's not the preferable way of doing things anymore). Documentation suggests you to use Calendar.get(Calendar.SECOND)
which is what you should use in your code.
Note that from Java 8 you can use LocalDateTime#getSecond
method again.