- 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
Smita Kapse has Published 560 Articles
Smita Kapse
161 Views
To format message with long style format of date in Java, we use the MessageFormat class and the Date class. The MessageFormat class gives us a way to produce concatenated messages which are not dependent on the language. The MessageFormat class extends the Serializable and Cloneable interfaces.Declaration − The java.text.MessageFormat ... Read More
Smita Kapse
112 Views
To format message with short length format for date in Java, we use the MessageFormat class and the Date class. The MessageFormat class gives us a way to produce concatenated messages which are not dependent on the language. The MessageFormat class extends the Serializable and Cloneable interfaces.Declaration − The java.text.MessageFormat ... Read More
Smita Kapse
498 Views
In order to compile assert in Java, we simply set the boolean expression as false.Let us see an example program −Example Live Demopublic class Example { public static void main(String[] args) { assert false; System.out.println("Compiled and executed successfully!!!"); } }OutputCompiled and executed successfully!!!
Smita Kapse
811 Views
In order to match the city and state using regular expression, we use the matches method in Java. The java.lang.String.matches() method returns a boolean value which depends on the matching of the String with the regular expression.Declaration − The java.lang.String.matches() method is declared as follows −Example Live Demopublic class Example { ... Read More
Smita Kapse
7K+ Views
To replace one string with another string using Java Regular Expressions, we need to use the replaceAll() method. The replaceAll() method returns a String replacing all the character sequence matching the regular expression and String after replacement.Declaration − The java.lang.String.replaceAll() method is declared as follows −public String replaceAll(String regex, String ... Read More
Smita Kapse
514 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 ... Read More
Smita Kapse
197 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 ... Read More
Smita Kapse
6K+ Views
In order to generate random bytes in Java, we use the nextBytes() method. The java.util.Random.nextBytes() method generates random bytes and provides it to the user defined byte array.Declaration − The java.util.Random.nextBytes() method is declared as follows −public void nextBytes(byte[] bytes)where bytes is the byte array.Let us see a program to ... Read More
Smita Kapse
320 Views
In order to sort items of an ArrayList with Collections.reverseOrder() in Java, we need to use the Collections.reverseOrder() method which returns a comparator which gives the reverse of the natural ordering on a collection of objects that implement the Comparable interface.Declaration − The java.util.Collections.reverseOrder() method is declared as follows -public ... Read More
Smita Kapse
68 Views
In order to fill an array in Java, we use the Array.setInt() method. The java.lang.reflect.Array.setInt(Object array, int index, int value) method assigns the value of the component with a particular index of the given array object to the specified integer value.Declaration − The java.lang.reflect.Array.setInt(Object array, int index, int value) is ... Read More