- 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
Found 9321 Articles for Object Oriented Programming
![Sai Subramanyam](https://www.tutorialspoint.com/assets/profiles/13512/profile/60_68191-1512710774.jpg)
86 Views
The toString(Object[] a) method of the java.util.Arrays class returns a string representation of the contents of the specified Object array. If the array contains other arrays of elements, they are converted to strings by the Object.toString() method inherited from Object, which describes their identities rather than their contents. Example import java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { Object[] ob1 = new Object[] { 10, 20 }; System.out.println("The array is:"); for (Object number ... Read More
![Monica Mona](https://www.tutorialspoint.com/assets/profiles/13520/profile/60_87298-1512650151.jpg)
526 Views
Operator precedence determines the grouping of terms in an expression. This affects how an expression is evaluated. Certain operators have higher precedence than others; for example, the multiplication operator has higher precedence than the addition operator.Here, operators with the highest precedence appear at the top of the table, those with the lowest appear at the bottom. Within an expression, higher precedence operators will be evaluated first.CategoryOperatorAssociativityPostfix>() [] . (dot operator)Left to rightUnary>++ - - ! ~Right to leftMultiplicative>* /Left to rightAdditive>+ -Left to rightShift>>> >>> >= < == !=Left to rightBitwise AND>&Left to rightBitwise XOR>^Left to rightBitwise OR>|Left to ... Read More
![Monica Mona](https://www.tutorialspoint.com/assets/profiles/13520/profile/60_87298-1512650151.jpg)
76 Views
The java.util.Arrays.sort(Object[] a, int fromIndex, int toIndex) method sorts the specified range of the specified array of objects into ascending order, according to the natural ordering of its elements. The range to be sorted extends from index fromIndex, inclusive, to index toIndex, exclusive.Exampleimport java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { Object ob[] = {27, 11, 5, 44}; for (Object number : ob) { System.out.println("Number = " + number); } Arrays.sort(ob, 1, 3); System.out.println("Object array ... Read More
![karthikeya Boyini](https://www.tutorialspoint.com/assets/profiles/13518/profile/60_31598-1537784993.jpg)
63 Views
The sort(int[] a, int fromIndex, int toIndex) method of the java.util.Arrays class sorts the specified range of the specified array of integer value into ascending numerical order. The range to be sorted extends from index fromIndex, inclusive, to index toIndex, exclusive.Exampleimport java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { int iArr[] = {3, 1, 2, 18, 10}; for (int number : iArr) { System.out.println("Number = " + number); } Arrays.sort(iArr, 0, 3); System.out.println("int array with some ... Read More
![Sharon Christine](https://www.tutorialspoint.com/assets/profiles/13517/profile/60_82215-1512649681.jpg)
72 Views
The sort(Object[]) method of the java.util.Arrays class sorts the specified array of Objects into ascending order according to the natural ordering of its elements.Exampleimport java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { Object ob[] = {27, 11, 44}; for (Object number : ob) { System.out.println("Number = " + number); } Arrays.sort(ob); System.out.println("The sorted Object array is:"); for (Object number : ob) { System.out.println("Number = " + number); } } }OutputNumber = 27 Number = 11 Number = 44 The sorted Object array is: Number = 11 Number = 27 Number = 44
![Sharon Christine](https://www.tutorialspoint.com/assets/profiles/13517/profile/60_82215-1512649681.jpg)
161 Views
The instanceof operator is used only for object reference variables. The operator checks whether the object is of a particular type (class type or interface type).Examplepublic class Test { public static void main(String args[]) { String name = "James"; boolean result = name instanceof String; System.out.println(result); } }Outputtrue
![Swarali Sree](https://www.tutorialspoint.com/assets/profiles/13515/profile/60_84115-1512649510.jpg)
64 Views
The sort(int[]) method of the java.util.Arrays class sorts the specified array of integer values into ascending numerical order.Exampleimport java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { int iArr[] = {2, 1, 9, 6, 4}; for (int number : iArr) { System.out.println("Number = " + number); } Arrays.sort(iArr); System.out.println("The sorted int array is:"); for (int number : iArr) { System.out.println("Number = " + number); } } }Output Number = 2 Number = 1 Number = 9 Number = 6 Number = 4 The sorted int array is: Number = 1 Number = 2 Number = 4 Number = 6 Number = 9
![Swarali Sree](https://www.tutorialspoint.com/assets/profiles/13515/profile/60_84115-1512649510.jpg)
13K+ Views
The conditional operator is also known as the ternary operator. This operator consists of three operands and is used to evaluate Boolean expressions. The goal of the operator is to decide; which value should be assigned to the variable. The operator is written as:variable x = (expression)? value if true: value if falseExamplepublic class Test { public static void main(String args[]) { int a, b; a = 10; b = (a == 1) ? 20: 30; System.out.println("Value of b is: " + b); b = (a == 10) ? 20: 30; System.out.println(“Value of b is: " + b); } }OutputValue of b is: 30 Value of b is: 20