Interview Questions and Answers - Order By Rating Q271. Write code to print a Pyramid pattern ? Core Java
Ans. public static void printTriagle(int n)
{
// outer loop to handle number of rows
// n in this case
for (int i=0; i1; j--)
{
// printing spaces
System.out.print(" ");
}
// inner loop to handle number of columns
// values changing acc. to outer loop
for (int j=0; j<=i; j )
{
// printing stars
System.out.print("* ");
}
// ending line after each row
System.out.println();
}
}
// Driver Function
public static void main(String args[])
{
int n = 5;
printTriagle(n);
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q272. Can we have multiple inheritance in java using abstract class ? Core Java
Ans. No Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  abstract class   multiple inheritance  object oriented programming (oops)  oops concepts Asked in 2 Companies Q273. What is the difference between abstraction and abstract class ? Core Java
Ans. Abstract class is one of the facility for achieving abstraction in Java. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Ans. == compares values === is used in scripting languages for comparing two values as well as there data tpe. like in js,php. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  ==  ===  == vs === Asked in 13 Companies basic   frequent Q275. How to calculate string length without using inbuilt function Core Java
This question was recently asked at 'Softenger'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  code  coding  design  string length Asked in 1 Companies basic Q276. What is the following code doing ?
private static final String[] COLORS = new String[] { "Red", "Green", "Blue" }; Core Java
Ans. We are initializing a static and constant string array named as COLORS using Strings "Red","Green" and "Blue". Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q277. Have you used Java 8 Lambda expressions ? Core Java
This question was recently asked at 'One Click Retail'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 8  lambda expressions Asked in 1 Companies   frequent Q278. Write a Program to print a pattern ? Core Java
This question was recently asked at 'Real come info'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies basic Q279. Which of the following is insertion heavy - HashSet or TreeSet ? Core Java
Ans. TreeSet as it needs elements in a particular order Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q280. What is the difference between TreeSet and TreeMap ? Core Java
Ans. TreeSet contains only values as elements whereas TreeMap contains Key value pairs. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  reeMap  TreeSet  Collections  sorted collection Asked in 1 Companies   rare Q281. How executor service is better than using primitive Threading mechanism using Thread class or runnable Interface ? Core Java
This question was recently asked at 'Symantec'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  multithreading  threads Asked in 1 Companies Q282. How does encoding affect using Reader / writer classes or Stream classes in Java ? Core Java
Ans. Which group of bytes represent which character is defined by character encoding. So when reading character by character from a stream of bytes using Reader, specifying character encoding becomes significant as the same group of bytes can represent different character in different character encoding(Eg UTF-8 and UTF-16 etc.) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  File io  File handling  Reader  Writer  Stream Asked in 1 Companies Q283. How do you debug Javascript code ? JavaScript
Ans. Possible Answer - I use either Firebug or Chrome Developer tool. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q284. What is the difference between Java OR operator and Java script OR operator ? JavaScript
This question was recently asked at 'Symantec'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q285. Can you name few Java packages which you frequently used ? Core Java
This question was recently asked at 'Symantec'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q286. is Java top down programming language or bottom up programming language? Core Java
Ans. bottom up programming language Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q287. Write Java code that would cause deadlock ? Core Java
Ans. https://howtodoinjava.com/java/multi-threading/writing-a-deadlock-and-resolving-in-java/ Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  multithreading  threads  deadlock Asked in 1 Companies intermediate Q288. how is the internal code for the "volatile" implemented ? Core Java
This question was recently asked at 'Symantec'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  volatile Asked in 1 Companies Q289. Can methods without a return type be declared in Java? Is there a difference between void return type and no return type ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q290. What is the default execution method in Java? Core Java
Ans. public static void main(String[] args) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  main method Q291. What will happen if there is an exception in Java finally block ? Core Java
Ans. The regular behavior of exception handling will occur. It will look for any immediate catch handler and if none is provided, it would be transmitted to the callers until a catch handler is found or it's out of main function. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  exceptions  finally Q292. Difference between final and finally Core Java
Ans. final can be used for variables , methods and class. A final variable cannot be changed , a final method cannot be overridden , a final class cannot be inherited.
Finally is a block which is used after Try and catch, a finally block is always executed. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q293. Tell about shallow and deep cloning ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  cloning Q294. Difference between 32 bit and 64 bit JVM ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q295. How do we do Inheritance in Java ? Core Java
Ans. By extending class or implementing interface. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Ans. Dynamic Binding happens at runtime. Method overriding is an example of Dynamic Binding Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q297. Which is the best collections for maintaining elements in an order ? Core Java
This question was recently asked at 'Dell'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q298. Which statement is used to exit a function in java script ? JavaScript
Ans. return Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q299. How can java script access a database ? JavaScript
This question was recently asked at 'American Express'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies This question was recently asked at 'American Express'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies