- Trending Categories
- 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
Maruthi Krishna has Published 951 Articles
Maruthi Krishna
14K+ Views
String to HexadecimalThe toHexString() method of the Integer class accepts an integer as a parameter and returns a hexadecimal string. Therefore, to convert a string to a hexadecimal String −Get the desired String.Create an empty StringBuffer object.Convert it into a character array using the toCharArray() method of the String class.Traverse ... Read More
Maruthi Krishna
3K+ Views
Using the isDigit() methodThe isDigit() method of the java.lang.Character class accepts a character as a parameter and determines whether it is a digit or not. If the given character is a digit this method returns true else, this method returns false.Therefore, to determine whether the first character of the given ... Read More
Maruthi Krishna
1K+ Views
Once you initialize a final variable you cannot modify its value further. i.e. You can assign value to a final variable only once. If you try to assign value to a final variable a compile time error will be generated.Example Live Demopublic class FinalExample { final int j = 100; ... Read More
Maruthi Krishna
4K+ Views
To validate a string for alphabets you can either compare each character in the String with the characters in the English alphabet (both cases) or, use regular expressions.Example1The following program accepts a string value (name) from the user and finds out whether given string is a proper name by comparing ... Read More
Maruthi Krishna
835 Views
Once you declare a variable final, after initializing it, you cannot modify its value further. Moreover, like instance variables, final variables will not be initialized with default values.Therefore, it is mandatory to initialize final variables once you declare them. If not a compile time error will be generated.Example Live Demopublic class ... Read More
Maruthi Krishna
278 Views
Using copyOf() methodThe copyOf() method of the Arrays class (java.util package) accepts two parameters −an array (of any type).an integer value representing length.And copies the contents of the given array from starting position to given length and returns the new array.Example Live Demoimport java.util.Arrays; public class CopyingSectionOfArray { public static ... Read More
Maruthi Krishna
14K+ Views
The get() method of the ArrayList class accepts an integer representing the index value and, returns the element of the current ArrayList object at the specified index.Therefore, if you pass 0 to this method you can get the first element of the current ArrayList and, if you pass list.size()-1 you ... Read More
Maruthi Krishna
4K+ Views
The contains() method of the String class accepts Sting value as a parameter, verifies whether the current String object contains the specified String and returns true if it does (else false).The toLoweCase() method of the String class converts all the characters in the current String into lower case and returns.To ... Read More
Maruthi Krishna
2K+ Views
Using the subList() and the clear() methodsThe subList() method of the List interface accepts two integer values representing indexes of the elements and, returns a view of the of the current List object removing the elements between the specified indices.The clear() method of List interface removes all the elements from ... Read More
Maruthi Krishna
3K+ Views
To sort the string that contains numbers in java −Get the String.Create an empty integer array.The split() method of the string class accepts a string representing a delimiter, splits the current string into an array of tokens. Using this method split the given string into an array of tokens.The parseInt() ... Read More