Get the List of All Public Fields in Java

Smita Kapse
Updated on 25-Jun-2020 14:59:28

760 Views

An array of field objects is returned by the method java.lang.Class.getFields(). These field objects include the accessible public fields of the class that is represented by the class object.Also, the getFields() method returns a zero length array if the class or interface has no public fields that are accessible or if a primitive type, array class or void is represented in the Class object.A program that demonstrates this is given as follows −Example Live Demoimport java.lang.reflect.*; public class Demo {    public static void main(String[] argv) throws Exception {       Class c = java.lang.Thread.class;       Field[] fields ... Read More

Perform Animation on CSS Padding Top Property

Daniol Thomas
Updated on 25-Jun-2020 14:59:08

287 Views

To implement animation on padding-top property with CSS, you can try to run the following code −ExampleLive Demo                    div {             width: 350px;             height: 150px;             outline: 3px solid maroon;             animation: myanim 3s infinite;          }          @keyframes myanim {             30% {                padding-top: 60px;             }          }                     CSS padding-top property          

Remove Preference from a Preference Node in Java

Nancy Den
Updated on 25-Jun-2020 14:58:52

547 Views

In order to remove a preference from a preference node in Java, we use the remove() method. The remove method() removes all the values associated with the specified key in the preference node.Declaration − The java.util.prefs.Preferences.remove() method is declared as follows −public abstract void remove (String key)where key is the key whose preference is to be removedThe remove methods throws the following exceptions −NullPointerExceptionThis exception occurs when the key is nullIllegalStateExceptionThis exception is thrown when the ancestor node is removed by the removeNode() method.Let us see a program to remove the preference from a preference node −Example Live Demoimport java.util.prefs.Preferences; public ... Read More

CSS voice-pitch Speech Media Property

Ankith Reddy
Updated on 25-Jun-2020 14:58:21

116 Views

The voice-pitch property in CSS is used to set the baseline pitch of the speaking voice. Here, you can set the pitchvoice-pitch: [[x-low | low | medium | high | x-high]]The following is an examplep {    voice-pitch: low; }

Fill Elements in a Short Array in Java

Anvi Jain
Updated on 25-Jun-2020 14:57:59

210 Views

Elements can be filled in a short array using the java.util.Arrays.fill() method. This method assigns the required short value to the short array in Java. The two parameters required are the array name and the value that is to be stored in the array elements.A program that demonstrates this is given as follows −Example Live Demoimport java.util.Arrays; public class Demo {    public static void main(String[] argv) throws Exception {       short[] shortArray = new short[5];       short shortValue = 1;       Arrays.fill(shortArray, shortValue);       System.out.println("The short array content is: " + Arrays.toString(shortArray)); ... Read More

CSS Speak as Speech Media Property

George John
Updated on 25-Jun-2020 14:57:43

132 Views

Set whether the text is to be spoken or spelled using the speak-as speech media property.You can spell the text, speak the numeral, etc. To spell out, the following is an exampleabbr {    speak-as: spell-out; }Above, I have used spell-out that spells out one letter at a time.

Export Preferences to XML File in Java

Krantik Chavan
Updated on 25-Jun-2020 14:57:16

757 Views

In order to export preferences to an XML file in Java, we need to use the exportSubtree() method. This method emits an XML document showing all of the preferences contained in this node and all of its descendants. This XML document provides an offline backup of the subtree rooted at the node.Declaration − The java.util.prefs.Preferences.exportSubtree method is declared as follows −public abstract void exportSubtree(OutputStream os) throws IOException, BackingStoreExceptionLet us see a program to export preferences to an XML file in Java −import java.io.FileOutputStream; import java.util.prefs.Preferences; public class Example {    public static void main(String args[]) throws Exception {    Preferences ... Read More

Determine If a Preference Node Exists in Java

Nancy Den
Updated on 25-Jun-2020 14:56:28

693 Views

In order to determine the existence a preference node in Java, we use the nodeExists() method. The nodeExists() method returns a boolean value. It returns true when the specified preference node exists in the same tree as this node.Declaration − The java.util.prefs.Preferences.remove() method is declared as follows −public abstract boolean nodeExists(String pathname)throws BackingStoreExceptionwhere pathname is the path name of the node whose existence needs to be determined.Let us see a program to determine if a preference node exists in Java −Example Live Demoimport java.util.prefs.Preferences; public class Example {    public static void main(String[] args) throws Exception {       boolean ... Read More

Animate CSS Padding Left Property

Chandu yadav
Updated on 25-Jun-2020 14:56:10

486 Views

To implement animation on padding-left property with CSS, you can try to run the following codeExampleLive Demo                    div {             width: 350px;             height: 150px;             outline: 3px solid orange;             animation: myanim 3s infinite;          }          @keyframes myanim {             50% {                padding-left: 20px;             }          }                     CSS padding-left property          

Display Maximum Amount of Memory in Java

Smita Kapse
Updated on 25-Jun-2020 14:55:44

273 Views

In order to display the maximum amount of memory in Java, we use the maxMemory() method. It is a method of the java.lang.Runtime Class. It returns the maximum amount of memory that the Java Virtual Machine will try to use.Declaration − The java.lang.Runtime.maxMemory() method is declared as follows −public long maxMemory()Let us see a program to display the maximum amount of memory in Java −Example Live Demopublic class Example {    public static void main(String[] args) {       // print statement at the start of the program       System.out.println("Start...");       // displays the maximum memory ... Read More

Advertisements