Showing posts with label JAVA ASSIGNMENTS. Show all posts
Showing posts with label JAVA ASSIGNMENTS. Show all posts

Monday, 26 June 2017

Top 25 Most Frequently Asked Interview Core Java Interview Questions ~ foundjava

We are sharing 25 java interview questions , these questions are frequently asked by the recruiters.Java questions can be asked from any core java topic . So we try our best to provide you the java interview questions and answers for experienced which should be in your to do list before facing java questions in  technical interview  .

Top 25  Java Interview Questions :

1. Which two method you need to implement for key Object in HashMap ?

2. What is immutable object? Can you write immutable object? 

3. What is the difference between creating String as new() and literal?


4. What is difference between StringBuffer and StringBuilder in Java ?

5.  Write code to find the First non repeated character in the String  ?

6. What is the difference between ArrayList and Vector ?

7. How do you handle error condition  while writing stored procedure or accessing stored procedure from java?

8. What is difference between Executor.submit() and Executer.execute() method ?

9. What is the difference between factory and abstract factory pattern?

10. What is Singleton? is it better to make whole method synchronized or only critical section synchronized ?

11. Can you write critical section code for singleton?

12. Can you write code for iterating over hashmap in Java 4 and Java 5 ?

13. When do you override hashcode and equals() ?

14. What will be the problem if you don't override hashcode() method ?

15. Is it better to synchronize critical section of getInstance() method or whole getInstance() method ?

16. What is the difference when String is gets created using literal or new() operator ?

17. Does not overriding hashcode() method has any performance implication ?

18. What’s wrong using HashMap in multithreaded environment? When get() method go to infinite loop ?

19. 
 What do you understand by thread-safety ? Why is it required ? And finally, how to achieve thread-safety in Java Applications ? 


20.  What will happen if you call return statement or System.exit on try or catch block ? will finally block execute?


19. Can you override private or static method in Java ?

20. What will happen if we put a key object in a HashMap which is already there ?

21. If a method throws NullPointerException in super class, can we override it with a method which throws RuntimeException?

22. What is the issue with following implementation of compareTo() method in Java


23. How do you ensure that N thread can access N resources without deadlock


24. What is difference between CyclicBarrier and CountDownLatch in Java ?

25. Can you access non static variable in static context?
Read More »

Sunday, 25 June 2017

TOP 10 JAVA WEBSITES OR BLOGS ~ foundjava

Java is one of the most Popular Education in the world these days and there is lots of tutorials websites or blogs on the internet. But today FOUND JAVA is going to tell you top 10 java websites or blogs. So here are top 10 List :-
Read More »

java video tutorial in hindi - More on Int and String Variable ~ foundjava

Setting up Java on your computer


Read More »

java video tutorial in hindi - Variables and Int datatype ~ foundjava

Setting up Java on your computer


Read More »

java video tutorial in hindi - More Explanation and Errors ~ foundjava

Setting up Java on your computer


Read More »

java video tutorial in hindi - First Program ~ foundjava

Setting up Java on your computer


Read More »

java video tutorial in hindi - Setting up Java on your computer ~ foundjava

Setting up Java on your computer

Read More »

Using Loops in Java ~ foundjava

जावा में लूप्स एक बहुत ही महत्वपूर्ण विषय है | इसको समझने के लिए हम दो प्रोग्राम देखेंगे एक वोह जो हम बिना लूप के बनायेंगे और दूसरा वोह जहा हम लूप का प्रयोग करेंगे |  इन दोनों प्रोग्राम्स को देखने के बाद आप खुद मानेगे की लूप कितने आवश्यक है|

/*************************************************************************
 *
 *  यहाँ "Hello, World" को दस बार प्रिंट करना है | आपको येही प्रोग्राम लूप की मदद 
  *  से आसानी से प्रिंट करना इसके बाद में बतओंगा.
 *************************************************************************/
Read More »

Leap Year Program ~ foundjava

/*************************************************************************
 *  Compilation:  javac LeapYear.java
 *  Execution:    java LeapYear N
 *  
 *  प्रिंट true अगर N लीप इयर है तोह वरना false प्रिंट करो 
 *  माना के N >= 1582, Gregorian कैलेंडर के अनुसार .
 *
 *  % java LeapYear 2004
 *  true
 *
 *  % java LeapYear 1998
 *  false
Read More »

Class Inheritance जावा क्लास का inheritance ~ foundjava

Java Class Inheritance

जावा में साधारणतः ऑब्जेक्ट को क्लास के द्वारा define किया जाता है । इतना ही नहीं कही बार सिर्फ क्लास का नाम सुनकर ही आपको ऑब्जेक्ट के बारे में कही जानकारी स्वत मिल जाती है | जैसे में आपको कहू की यहाँ हम हीरो ट्रेक्स की बात कर रहे है , तो आपको कुछ अटपटा सा लगेगा पर जैसे ही में आपको कहूँगा की यह साइकिल क्लास का ऑब्जेक्ट है , आप कही बातो का अंदाज़ा स्वयं ही लगा लेंगे जैसे इसके दो tyre होंगे | इसमें pedal होंगे , रफ़्तार होगी और भी कही चीज़े |
Read More »

Calculate Interest using Applets एप्लेट की मदद से ब्याज निकलना ~ foundjava

Simple Interest Calculation with Applet

आज हम जिस प्रोग्राम को डिस्कस करने जा रहे है इसे आपने कही पुराने फीचर मोबाइल फ़ोन में देखा होगा। यह प्रोग्राम  आसान होते हुए भी जावा एप्लेट को समझने के लिए सबसे उपयुक्त है।

 
/**
Read More »

Java Hello Swing Program जावा का हेल्लो स्विंग प्रोग्राम ~ foundjava

Java Swing Hello Program

// एक अप्प्लेट जो button की तरह दिखाई देगा उस पर लिखा होगा
// "Click me".  जब उस button पर क्लिक होगा
// तब एक बॉक्स खुलेगा जिस पर लिखा होगा  Hello from Swing.

import javax.swing.*;    // Swing GUI (ग्राफिक user interface )classes को defined करना
import java.awt.event.*; // Event handling class को define  करना

public class HelloSwing extends JApplet implements ActionListener {
Read More »

Java Applets जावा में अप्पलेट्स ~ foundjava

Java Applets

जावा अप्पलेट्स एक छोटी सी एप्लीकेशन होती है जो इसके यूजर को बाइट कोड के रूप में प्रदान की जाती है । जावा ही की तरह एप्लेट भी प्लेटफार्म से स्वतंत्र होते है और इन्हें किसी भी मशीन में चलाया जा सकता है । यूजर इनको किसी भी वेब ब्राउज़र से एक्सेस कर सकता है ।
<html>
<head>
  <title>Namaste Bharat</title>
</head>
<body>
  <h1>Java applet ka ek example</h1>
applet ko html mein embedded karne ka tarika: <applet code="NamasteBharat.class" height="40" width="200">
  </applet><br />

</body>
Read More »

Package in Java जावा में पैकेज की उपयोगिता ~ foundjava

What is package in java?

हमने कही बार जावा के प्रोग्रामो में पैकेज का उपयोग किया होगा , लेकिन कही विध्यार्ती इनकी उपयोगिता को समझने में कठिनाई महसूस करते है । आज के इस लेख में हम देखेंगे की पैकेज क्या है और इनका उपयोग क्यों किया जाता है । अंत में मैने जावा के कुछ पैकेज के नाम और उनके उपयोग का विवरण दिया है , इस से आपको इनके उपयोगिता को समझने में आसानी होगी ।

सबसे पहले हम यह देखने की हमे पैकेज की आवश्यकता क्यों पड़ी ?
Read More »

Concatenation of Strings जावा में स्ट्रिंग्स को जोड़ना ~ foundjava

String Concatenation

दो स्ट्रिंग्स को जोड़ने के काम को स्ट्रिंग concatenation कहते है | वैसे जावा operators(-, *, /) को सीधा स्ट्रिंग्स पर कार्य करने की इज़ाज़त नहीं देता पर स्ट्रिंग को जोड़ने के लिए इसमें + का इस्तमाल करने की हमे छुट है | इससे स्ट्रिंग को जोड़ना हमारे लिए बहुत आसान हो जाता है | आप में से कही लोग को लग रहा होगा की स्ट्रिंग को जोड़ने में इतना खास क्या है की जावा ने हमे इससे जोड़ने की छुट दी | अगर आप रोज़ कंप्यूटर पर काम करने वालो में है तोह आपने देखा होगा की कही सॉफ्टवेर हम से पहला और अंतिम नाम अलग अलग पूछते है और जब स्टोर करते है तोह एक साथ कर देते है | ऐसे है बहुत सारे सॉफ्टवेर इसका बहुत ज्यादा बार उपयोग करते है | 
Read More »

Strings in Java जावा में स्ट्रिंग्स ~ foundjava

Strings in Java


स्ट्रिंग को जावा में क्यो बनाया गया ?

अक्षरो के क्रम को बताने के लिए जावा स्ट्रिंग ऑब्जेक्ट को बनाया गया . जैसे a , b , c तीन अलग अलग अक्षर है , अगर हम इन्हें साथ लिखना चाहे जैसे abc तोह बिना स्ट्रिंग ऑब्जेक्ट के हमे इसे बताना बहुत मुश्किल होगा  , पर स्ट्रिंग मेथड से हम इस काम को आसानी से कर सकते है |  इतना ही नहीं जावा में हम स्ट्रिंग पर सीधे रूप में काम कर सकते है जैसे उन्हें जोड़ और घटा भी सकते है | abc को अगर हमे def से जोड़ना हो तो हम स्ट्रिंग क्लास के जोड़ने वाले function का प्रयोग कर सकते है | 
Read More »

Functions in Java Part 2 जावा functions का द्वित्य भाग ~ foundjava

Functions in java Part 2

Functions के द्वितीय भाग में हम कही functions बनायेंगे और देखेंगे की हम इसका कैसे प्रयोग कर सकते है |  

// अगर हमे 90 डिग्री वाले त्रिकोण का कर्ण (hypotenuse) निकालना हो , तो हमे 
//उसकी दोनो बाजू (sides) का square निकाल कर जोड़ना पड़ता है |
// अब देखिये हम इसका function कैसे बनाते है
 
    public static double hypotenuse(double a, double b) { // public और static का
Read More »

Functions in Java जावा में functions को समझे ~ foundjava

Functions in Java

functions का नाम सुनते ही काफी विद्यारती डर जाते है | जबकि इनको आपका काम आसान करने के लिए बनाया गया है | function को आप एक ऐसी मशीन समझ सकते है जो सिर्फ एक काम करना जानती है | वोह काम कुछ भी हो सकता है | जैसे कोई मशीन सिर्फ दो नंबर को जोड़ना जानती हो , तोह जब भी आप उसे दो नंबर देंगे वैसे ही वोह आपको उसे जोड़ कर बता देगी | लेकिन चुकी मशीन तोह मशीन ही होती है , दो नंबर को जोड़ने वाली मशीन को तीसरा नंबर देने पर उसको नहीं पता होता की क्या करना है ? इसीलिए जावा ने हमे कहा की लीजिये हम यह आप पर छोड़ते है की आपको कैसी मशीन बनानी है | आप जैसे छाए वैसे मशीन बनाये | और उस मशीन का नाम जावा ने function दे दिया | 
Read More »

Finding Integer in a Array अर्रे में integer का पता लगाना ~ foundjava

Finding a integer in Array

/**
 * हम इस प्रोग्राम में एक अर्रे A में N integer को सर्च करेंगे, अगर N हमे अर्रे में नहीं मिला तो
 * हम -1 को return करेंगे अन्यथा अगर N अर्रे में है तो हमे जहा अर्रे मिला उसका index को return
 * करेंगे, index i की वोह पहली value है जो A[i] == N condition को satisfy करती है.
 */

 // यह एक स्तटिक function है जिसके दो आर्गुमेंट्स है , एक तो अर्रे खुद और दूसरा
// वह integer जो हमे खोजना है.
Read More »

Two Dimensional Array दो आयामी अर्रे ~ foundjava

Two Dimensional Arrays


अगर हमे कभी matrix की values को array में स्टोर करना हो तोह हमे द्वि आयामी (2
Read More »