- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9326 Articles for Object Oriented Programming
90 Views
The current ticking with the system clock in seconds can be obtained using the method tickSeconds() in the Clock Class in Java. This method requires a single parameter i.e. the time zone and it returns the current ticking value in seconds.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo { public static void main(String[] args) { ZoneId zone = ZoneId.of("Australia/Melbourne"); Clock c = Clock.tickSeconds(zone); System.out.println("The current ticking value in seconds is: " + ... Read More
199 Views
The instant of the base clock can be rounded off for the required duration using the method tick() in the Clock Class in Java. This method requires two parameters i.e. the base clock and the duration of the tick. Also, the instant of the base clock rounded off for the required duration is returned.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Main { public static void main(String[] args) { Clock bClock = Clock.systemDefaultZone(); Instant i = bClock.instant(); System.out.println("The Instant of the base clock is: ... Read More
169 Views
The current instance of the clock for the required zoneID can be obtained using the method system() in Clock Class in Java. This method requires a single parameter i.e. the zoneID or the time zone and it returns the current instance of the clock for that time zone.A program that demonstrates this is given as follows −Exampleimport java.time.*; public class Main { public static void main(String[] args) { ZoneId zone = ZoneId.of("Australia/Melbourne"); Clock c = Clock.system(zone); ZonedDateTime zdt = ... Read More
119 Views
A clock copy of the clock object can be obtained using the method withZone() in Clock Class in Java. This method is used on a clock object to obtain a clock copy. The withZone() method requires a single parameter i.e. the zone that is required to change the time zone. Also, it returns the clock copy of the clock object with the required time zone.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo { public static void main(String[] args) { Clock c1 = Clock.systemDefaultZone(); ZoneId zone = ... Read More
153 Views
The current ticking value in minutes can be obtained using the method tickMinutes() in the Clock Class in Java. This method requires a single parameter i.e. the time zone and it returns the current ticking value in minutes.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo { public static void main(String[] args) { ZoneId zId = ZoneId.of("Australia/Melbourne"); Clock c = Clock.tickMinutes(zId); System.out.println("The current ticking value in minutes is: " + c.instant()); ... Read More
72 Views
The property values in the Provider can be viewed with an unmodifiable Collection view that is obtained using the method values() in the class java.security.Provider. This method requires no parameters and it returns an unmodifiable Collection view of the property values.A program that demonstrates this is given as follows −Example Live Demoimport java.security.*; import java.util.*; public class Demo { public static void main(String[] argv) throws Exception { try { Signature sign = Signature.getInstance("DSA"); Provider p = sign.getProvider(); Collection val = p.values(); ... Read More
60 Views
The property keys in the provider can be viewed using an unmodifiable Set view using the method keySet() in the class java.security.Provider. This method requires no parameters and it returns the unmodifiable Set view for the property keys as required.A program that demonstrates this is given as follows −Example Live Demoimport java.security.*; import java.util.*; public class Demo { public static void main(String[] argv) throws Exception { try { Signature sign = Signature.getInstance("DSA"); Provider p = sign.getProvider(); Set set = p.keySet(); Iterator ... Read More
77 Views
An enumeration of the keys of the required hash table can be obtained using the keys() method in the class java.security.Provider. This method requires no parameters and it returns the enumeration of the keys of the hash table.A program that demonstrates this is given as follows −Example Live Demoimport java.security.*; import java.util.*; public class Demo { public static void main(String[] argv) throws Exception { try { Signature sign = Signature.getInstance("DSA"); Provider p = sign.getProvider(); Enumeration enumeration = p.keys(); System.out.println("The enumeration of ... Read More
221 Views
The service that can describe the implementation of a Provider in regards to any algorithm is obtained using the method getService() in the class java.security.Provider. This method requires two parameters i.e. the service type required and the algorithm name of the required service.A program that demonstrates this is given as follows −Example Live Demoimport java.security.*; import java.util.*; public class Demo { public static void main(String[] argv) throws Exception { try { Signature sign = Signature.getInstance("SHA256withDSA"); Provider p = sign.getProvider(); Provider.Service s = p.getService("Signature", sign.getAlgorithm()); ... Read More
282 Views
A specific key can be used to search for the required property in the property list using the method getProperty() in the class java.security.Provider. This method requires a single parameter i.e. the key required to search for the property. It returns the property value for the key or returns null if the property value is not available.A program that demonstrates this is given as follows −Example Live Demoimport java.security.*; import java.util.*; public class Demo { public static void main(String[] argv) throws Exception { try { KeyPairGenerator kpGenerator = KeyPairGenerator.getInstance("DSA"); ... Read More