:: 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 (1721)
 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 (146)
 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
When you will synchronize your code?   2
What are the types of data passing mechanisams under JMS specification?   1
What is waiting state? In what ways a thread can enter into waiting state? Wipro 2
Hello, I'm java developer. My skill is programming with java,jsp, struts, struts2+spring, hibernate, eclipse, tomcat, mysql,Oracle,Middlegen and other open source technology. I'm interest work any web base project that use my ability above. The thing is that I have never got any chance to work in this field though i am very much comfort with my skills. So if any body want me then i will happily join you. Also I have also some of my friends if you. If you interest to outsource any project to me then also you are welcome. you can reach me by email at   4
What is daemon thread?   3
Urgent Openings for Java and .NET ( India, Singapore, Australia, Japan) Wipro 2
What is JasperReports?   2
What is RMI Registry? Siemens 5
What are Benefits of Connection Pooling?   2
what is catalina in tomcat server. IBM 9
What are different types of layout managers in java.awt package? CA 2
Thread life cycle? TCS 3
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.   ::