![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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
![Rahul Sharma](https://www.tutorialspoint.com/assets/profiles/14297/profile/60_102977-1513054044.jpg)
627 Views
Integer literals represent fixed integer values like 900, 12, 400, -222 etc. (with in the integer range). Whereas, floating point literals represents fractional values i.e. numbers with decimal values like 25.53, 45.66, 58.66 etc. while writing these literals we should use the notation f or F as 25.53. Example Live Demo public class StringExample { public static void main(String args[]){ int num1 = 100; float num2 = 30.0f; System.out.println("Value of integer:"+num1); System.out.println("Value of integer:"+num2); } } Output Value of integer:100 Value of integer:30.0
![Johar Ali](https://www.tutorialspoint.com/assets/profiles/14293/profile/60_101691-1513053093.jpg)
2K+ Views
A literal is a source code representation of a fixed value. They are represented directly in the code without any computation. Literals can be assigned to any primitive type variable. Example byte a = 68; char a = 'A' byte, int, long, and short can be expressed in decimal(base 10), hexadecimal(base 16) or octal(base 8) number systems as well. Prefix 0 is used to indicate octal, and prefix 0x indicates hexadecimal when using these number systems for literals. For example − int decimal = 100; int octal = 0144; int hexa = 0x64; String ... Read More
![Amit Sharma](https://www.tutorialspoint.com/assets/profiles/14294/profile/60_103411-1513053466.png)
2K+ Views
Data types are those which specify the type of data represented by the variable and literal is the that is stored in to the variable. A literal is a source code representation of a fixed value. They are represented directly in the code without any computation. Literals can be assigned to any primitive type variable. Example byte a = 68; char a = 'A'
![Ali](https://www.tutorialspoint.com/assets/profiles/14292/profile/60_101553-1513052445.jpg)
238 Views
Reference datatypes in java are those which contains reference/address of dynamically created objects. These are not predefined like primitive data types. Following are the reference types in Java. class types − This reference type points to an object of a class. array types − This reference type points to an array. interface types − This reference type points to an object of a class which implements an interface. Once we create a variable of these types (i.e. when we create an array or object, class or interface). These variables only store the address of these values. Default ... Read More
![Rahul Sharma](https://www.tutorialspoint.com/assets/profiles/14297/profile/60_102977-1513054044.jpg)
8K+ Views
Reference datatypes in java are those which contains reference/address of dynamically created objects. These are not predefined like primitive data types. Following are the reference types in Java. class types − This reference type points to an object of a class. array types − This reference type points to an array. interface types − This reference type points to an object of a class which implements an interface. Once we create a variable of these types (i.e. when we create an array or object, class or interface). These variables only store the address of these values. Default ... Read More
![Sai Subramanyam](https://www.tutorialspoint.com/assets/profiles/13512/profile/60_68191-1512710774.jpg)
2K+ Views
Whenever we try to sort elements with null values using the sort method it throws an exception.The sort() method of the Arrays class also accepts a Comparator along with the array. Using comparator, you need to specify the order in which the elements need to be sorted.Using this method push all the null elements to last and sort the elements −Example Live Demoimport java.util.Arrays; import java.util.Comparator; public class ArrayWithNullsInOrder { public static void main(String args[]) { String[] myArray = {"JavaFX", null, "OpenCV", null, "Hadoop", null}; Arrays.sort(myArray, Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER)); System.out.println(Arrays.toString(myArray)); } }Output[Hadoop, JavaFX, OpenCV, null, null, null]Read More
![Lakshmi Srinivas](https://www.tutorialspoint.com/assets/profiles/13528/profile/60_91717-1512651120.jpg)
13K+ Views
To sort a String array in Java, you need to compare each element of the array to all the remaining elements, if the result is greater than 0, swap them.One solution to do so you need to use two loops (nested) where the inner loop starts with i+1 (where i is the variable of outer loop) to avoid repetitions in comparison.ExampleLive Demoimport java.util.Arrays; public class StringArrayInOrder { public static void main(String args[]) { String[] myArray = {"JavaFX", "HBase", "OpenCV", "Java", "Hadoop", "Neo4j"}; int size = myArray.length; for(int i = 0; i
![Monica Mona](https://www.tutorialspoint.com/assets/profiles/13520/profile/60_87298-1512650151.jpg)
618 Views
To sort an array in Java, you need to compare each element of the array to all the remaining elements and verify whether it is greater if so swap them.One solution to do so you need to use two loops (nested) where the inner loop starts with i+1 (where i is the variable of outer loop) to avoid repetitions in comparison.Exampleimport java.util.Arrays; import java.util.Scanner; public class ArrayInOrder { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter the size of the array that is to be created::"); ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
1K+ Views
To sort an array in Java, you need to compare each element of the array to all the remaining elements and verify whether it is greater if so swap them.One solution to do so you need to use two loops (nested) where the inner loop starts with i+1 (where i is the variable of outer loop) to avoid repetitions in comparison.Example Live Demoimport java.util.Arrays; import java.util.Scanner; public class ArrayInOrder { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter the size of the array that is to be created::"); ... Read More
![Sharon Christine](https://www.tutorialspoint.com/assets/profiles/13517/profile/60_82215-1512649681.jpg)
3K+ Views
You can convert a double array to a string using the toString() method. To convert a double array to a string array, convert each element of it to string and populate the String array with them.ExampleLive Demoimport java.util.Arrays; public class DoubleArrayToString { public static void main(String args[]) { Double[] arr = {12.4, 35.2, 25.6, 98.7, 56.4}; int size = arr.length; String[] str = new String[size]; for(int i=0; i