:: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Categories >> Software >> Java Related >> Java J2EE >> Advanced Java


 Core Java interview questions  Core Java Interview Questions (1728)
 Advanced Java interview questions  Advanced Java Interview Questions (332)
 Swing interview questions  Swing Interview Questions (44)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (196)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (147)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
Write a java program to find out the sum of harmonic series :
1 + ½ + 1/3 +  up to nth term , for any value of n.
 Question Submitted By :: Advanced-Java
I also faced this Question!!     Answer Posted By  
# 1
class Hermonic{
public static void main(String args[]){
BufferedReader in=new BufferedReader(new
double result = 0.0;
int num=0;
System.out.println("Enter a term which you want to sum:");
num = Integer.parseInt(in.readLine());
catch(Exception e){}
while(num > 0){
result = result +( (double) 1 / num);
System.out.println("Output of Harmonic Series is "+result);
Is This Answer Correct ?    2 Yes 0 No
Sourav Dey
# 2
package com.adder;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class GeneralJava {

* @param args
public static void main(String[] args) {
System.out.println(new GeneralJava().process

private double process(int n) {

BigDecimal retVal = BigDecimal.ZERO;

for (int i=1; i<= n; i++) {

BigDecimal adder =

retVal = retVal.add(adder);


return retVal.doubleValue();
Is This Answer Correct ?    4 Yes 3 No

Other Advanced Java Interview Questions
  Question Asked @ Answers
what is the use of Object Factories?   1
which deployment descriptor element is used to configure the authentication method? a. auth-config b. login-config c. sec-config   1
For an example, if we have some variable in run method, and we created one or more threads. Does all threads will share the same variable or a copy of variable is created for each thread??   1
On a computer that having single CPU, how multithreading concept can be achieved? Zensar 1
What is Stream and Types? Patni 2
what is a dirty read?   1
What is the O/P of the below Code Snippet ? And how does it imply the concept of call-by-value/call-by-reference. (Note : Pls ignore syntx errors) public class One { sop ("Into One--"); } public class Two extends One{ sop ("Into Two--"); } public class Home { One a; Two t; public static void main(argv[]) { sop ("In Home--"); sop(One.a); sop(Two.a); sop(One.t); sop(Two.t); } } Wipro 2
Explain bind(), rebind(), unbind() and lookup() methods?   1
How to synchronize jsp page? TCS 1
What is the main functionality of RRL(Remote Reference Layer)?   3
what is the Remote Stub?   1
What invokes a thread?s run() method?   2
For more Advanced Java Interview Questions Click Here 

Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
Copyright 2013  All Rights Reserved.   ::