:: 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
what is the proxy pattern?   1
What is UniCastRemoteObject and what is its use in RMI?   5
1) which method of the RequestDispatcher cannot be called once the output is sent to the client? a. forward b. include c. both a&b 2) which interface should an object implement to get notified of changes to the list of active sessions in a web application? a. HttpSessionListener b. HttpSessionActivationListener c. HttpSessionAttributeLIstener 3) A user can select multiple locations from a list box on an HTML form, which of the following methods can be used to retrieve all the selected location? a. getParameter() b. getParameterValues() c. getParamValues() 4) which of the following methods should be used to send character text to the client? a. ServletResponse.getWriter() b. ServletResponse.getOutputStream() c. ServletResponse.getOut() 5) which implicit object is always available in a JSP page? a. exception b. session c. out 6) which inclusion mechanism doesn't include the source of the page, rather the output of the page. a. include directive b. jsp:include action c. Bothe a& b 7) which attribute of the page controls whether a page participates in session or not? a. session-allowed b. session c. isSession   1
To make an object to begin executing as a separate thread, what method is used?   2
What is source and listener?   1
the advantages of polymorphic   1
what is DGC?   1
When you will synchronize your code?   2
what is difference between object state and behaviour?   2
Why JDBC has introduced   3
how we can implement interface in jsp ? Google 2
What is a layout manager?   1
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.   ::