Explain the difference between runnable and callable interface in java?
public class Garbage { int a=0; public void add() { int c=10+20; System.out.println(c); System.out.println(a); } public static void main(String args[]) { Garbage obj=new Garbage(); System.gc(); System.out.println("Garbage Collected"); obj.add(); } } Above is a code in java used for garbage collection. object obj has been created for the class Garbage and system.gc method is called. Then using that object add method is called.System.gc method if called the obj should be garbage collected?
How many threads can java run?
Can a method be overloaded based on different return type but same argument type?
Explain the difference between map and flatmap stream operation?
There is a Banking application. It has 2 types of account, Savings and Current. Write a method calculateInterest by passing an ArrayList of these account objects and calculate Interest accordingly. Write code for this situation
What is the relationship between class and object?
What is printwriter in java?
Write a java program to check if a number is prime or not?
Can we have multiple classes in a single file?
why use interface? if interface declear a method implement in class. why direct implement method in class
How java is platform independent?
41 Answers College School Exams Tests, Infosys, TCS,
what is the difference between Object Based Language and Object Oriented Language?