
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
213 Views
To find the smallest K digit number divisible by X, the Java code is as follows −Example Live Demoimport java.io.*; import java.lang.*; public class Demo{ public static double smallest_k(double x_val, double k_val){ double val = 10; double MIN = Math.pow(val, k_val - 1); ... Read More

AmitDiwan
5K+ Views
There are multiple ways in which the ‘n’thFibonacci number can be found. Here, we will use dynamic programming technique as well as optimizing the space.Let us see an example −Example Live Demopublic class Demo{ static int fibo(int num){ int first = 0, second = 1, temp; ... Read More

AmitDiwan
396 Views
When ‘public’ is used in ‘main’ −Example Live Demopublic class Demo{ public static void main(String args[]){ System.out.println("This is a sample only"); } }OutputThis is a sample onlyA class named Demo contains the main function that is public. It has a print function, which successfully compiles, executes ... Read More

AmitDiwan
1K+ Views
To replace null values with default value in Java Map, the code is as follows −Example Live Demoimport java.util.*; import java.util.stream.*; public class Demo{ public static Map null_vals(Map my_map, T def_val){ my_map = my_map.entrySet().stream().map(entry -> { if (entry.getValue() == null) ... Read More

AmitDiwan
1K+ Views
Static variable: Declared with the help of the keyword ‘static’, they are also known as class variables. They are defined within a constructor or outside a class function. When a variable is static, it is shared between all objects of the class, irrespective of the number of objects that are ... Read More

AmitDiwan
2K+ Views
To find the IP Address of the client, the Java code is as follows −Example Live Demoimport java.net.*; import java.io.*; import java.util.*; import java.net.InetAddress; public class Demo{ public static void main(String args[]) throws Exception{ InetAddress my_localhost = InetAddress.getLocalHost(); System.out.println("The IP Address of client is ... Read More

AmitDiwan
673 Views
To find the second most repeated word in a sequence in Java, the code is as follows −Example Live Demoimport java.util.*; public class Demo{ static String second_repeated(Vector my_seq){ HashMap my_map = new HashMap(my_seq.size()){ @Override public Integer get(Object key){ ... Read More

AmitDiwan
272 Views
To find the uncommon values concatenated from both the strings in Java, the code is as follows −Example Live Demoimport java.util.*; import java.lang.*; import java.io.*; public class Demo{ public static String concat_str(String str_1, String str_2){ String result = ""; int i; ... Read More

AmitDiwan
148 Views
To find specific column names, use information_schema.columns Here, I am using Id in place of columnA and Name in place of columnB −mysql> select table_name as TableNameFromWebDatabase -> from information_schema.columns -> where column_name IN ('Id', 'Name') -> group by table_name -> having count(*) = 3;This will ... Read More