:: 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 (1722)
 Advanced Java interview questions  Advanced Java Interview Questions (331)
 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
How many requests can a server fetch at a time?   1
explain the flow of struts? SolutionNET 2
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
whats is mean by jndi SolutionNET 4
i have a 1000 objects in data base i need to display those in jsp's how can i retrive those objects in jsp. (consider the performance issue)   2
1) Scenario: I developed my application on local system and everything is perfect and tested. Now on UAT this application is deployed on clustered server environment. They are logical or physically clustered. But application is not working over there. &#61656; What is the issue with application? &#61656; What are the first things which come in your mind? L&T 1
what is domain,give me some brief information about that?   1
difference between sql exception class and sql warning class   1
What is diffennce between AWT & SWING?   4
Urgent Openings for Java and .NET ( India, Singapore, Australia, Japan) Wipro 2
what is heepStored?   1
How will the struts know which action class to call when you submit a form? HeadStrong 6
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.   ::