
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
399 Views
To find the maximum and minimum element’s position in a list, the Java program is as follows −Example Live Demoimport java.util.*; import java.util.Arrays; import java.util.Collections; public class Demo{ public static int index_val(int my_arr[], int t){ if (my_arr == null){ return -1; ... Read More

AmitDiwan
603 Views
To iterate over a Stream with Indices in Java 8, the code is as follows −Example Live Demoimport java.util.stream.IntStream; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; public class Demo{ public static void main(String[] args){ String[] my_array = { "T", "h", "i", "s", "s", "a", "m", "p", "l", "e" }; ... Read More

AmitDiwan
5K+ Views
To sort words of sentence in ascending order, the Java code is as follows −Example Live Demoimport java.util.*; public class Demo{ static void sort_elements(String []my_str, int n){ for (int i=1 ;i= 0 && temp.length() < my_str[j].length()){ my_str[j+1] = my_str[j]; ... Read More

AmitDiwan
830 Views
To split the Even and Odd elements into two different lists, the Java code is as follows −Example Live Demoimport java.util.Scanner; public class Demo{ public static void main(String[] args){ int n, j = 0, k = 0; Scanner s = new Scanner(System.in); ... Read More

AmitDiwan
399 Views
To generate random numbers in a given range, the Java code is as follows −Example Live Demoimport java.util.Random; import java.util.*; public class Demo{ public static void main(String args[]){ Random my_rand = new Random(); List my_list_1 = new ArrayList(); int v_1 = ... Read More

AmitDiwan
1K+ Views
Let’s say we have an Octal number. To convert Octal to other bases like binary, hexadecimal, etc, the Java code is as follows −Example Live Demopublic class Demo{ public static String base_convert(String num, int source, int destination){ return Integer.toString(Integer.parseInt(num, source), destination); } public static void ... Read More

AmitDiwan
3K+ Views
Let us see how to write an empty function in Java −Example Live Demoimport java.util.Vector; public class Demo{ public static void my_empty_fun(){ } public static void main(String[] args){ System.out.println("In the main function"); my_empty_fun(); } }OutputIn the main functionAn empty function ... Read More

AmitDiwan
993 Views
Eeverytime a process or a code or a thread needs to run in Java, a runtime stack is created so as to store the operations performed while executing the thread.Every entry in the run-time stack is known as stack frame or activation record. Once a function has been called by ... Read More

AmitDiwan
3K+ Views
To merge two sets in Java, the code is as follows −Example Live Demoimport java.util.stream.*; import java.util.*; import java.io.*; public class Demo{ public static Set set_merge(Set set_1, Set set_2){ Set my_set = set_1.stream().collect(Collectors.toSet()); my_set.addAll(set_2); return my_set; } public ... Read More

AmitDiwan
335 Views
Following is the Java program to merge array into a new object array in Java −Example Live Demoimport java.util.stream.Stream; import java.util.Arrays; import java.io.*; public class Demo{ public static Object[] concat_fun(T[] my_obj_1, T[] my_obj_2){ return Stream.concat(Arrays.stream(my_obj_1), Arrays.stream(my_obj_2)).toArray(); } public static void main (String[] args){ ... Read More