Thursday 18 July 2013

The most frequently asked interview questions java


1.     What are string, string buffer and String builder?
Ans:-  String:
             String is a final class available in java.lang.package.
             String is immutable i.e String  object can't be modified
             We can create the string class object in three ways
  1. Using the new operator    eg: String s1= new String(“Java”);
  2. Without new operator as a string literal        eg: String s2= “Hello”;
  3. Cha array[] = {‘j’,’a’,’v’,’a’};      String s3 = new String(array) 
      String Buffer   :
      String Buffer  is a mutable ie. String Buffer object is mutable .
      String Buffer object will be created only one way that is using new operator. 


String
String Buffer
String objects are immutable
String Buffer object are mutable
We can create the string object in two ways
              With new operator
            Without new operator
We can create String Buffer object only in one way
           With new operator
String will use string constant pooling mechanism internally for the reusability of the string
There is no concept of pooling in the string Buffer
When you do any concatenation of strings always a new String object will be created for the result
When u do any concatenation then existing string only modified
String class methods are not synchronized
Majority of the string buffer class methods are synchronized.

    String Builder: String  Builder and String Buffer both are same only one difference is String Builder class  methods are not Synchronized.
       2.  What are the differences between these three Final, Finally and Finalize?
      Ans:- Final:  
          Final is a keyword can be used for the following 3 things 
  • To declare the final variables i.e.,  Final variable cannot be modified
  • To specify the final methods i.e.,  Final method cannot be overridden
  • To specify the final class  i.e.,  Final classes cannot be inherited
3. What does mean Garbage collector?
Ans:- 
  •  Garbage collector is form of memory management.
  •  It mostly uses mark and sweep algorithms. 
  • It is automatically invoked when program is being run(when JVM starts).
  • It can be also called by calling gc() method of run time class or system class in java. 
4. Why java is slower then C, C++ ?
Ans:-


 


 

Monday 27 August 2012

BIRT REPORT


Business Intelligence and Reporting Tools (BIRT) is an Eclipse-based open source reporting system for web applications, especially those based on Java and Java EE.
BIRT has two main components: a report designer based on Eclipse, and a runtime component that you can add to your app server. BIRT also offers a charting engine that lets you add charts to your own application.
With BIRT, you can add a rich variety of reports to your application.
  • Lists - The simplest reports are lists of data. As the lists get longer, you can add grouping to organize related data together (orders grouped by customer, products grouped by supplier). If your data is numeric, you can easily add totals, averages and other summaries.
  • Charts - Numeric data is much easier to understand when presented as a chart. BIRT provides pie charts, line & bar charts and many more. BIRT charts can be rendered in SVG and support events to allow user interaction.
  • Crosstabs - Crosstabs (also called a cross-tabulation or matrix) shows data in two dimensions: sales per quarter or hits per web page.
  • Letters & Documents - Notices, form letters, and other textual documents are easy to create with BIRT. Documents can include text, formatting, lists, charts and more.
  • Compound Reports - Many reports need to combine the above into a single document. For example, a customer statement may list the information for the customer, provide text about current promotions, and provide side-by-side lists of payments and charges. A financial report may include disclaimers, charts, tables all with extensive formatting that matches corporate color schemes.
BIRT reports consist of four main parts: data, data transforms, business logic and presentation.
  • Data - Databases, web services, Java objects all can supply data to your BIRT report. BIRT provides JDBC, XML, Web Services, and Flat File support, as well as support for using code to get at other sources of data. BIRT's use of the Open Data Access (ODA) framework allows anyone to build new UI and runtime support for any kind of tabular data. Further, a single report can include data from any number of data sources. BIRT also supplies a feature that allows disparate data sources to be combined using inner and outer joins.
  • Data Transforms - Reports present data sorted, summarized, filtered and grouped to fit the user's needs. While databases can do some of this work, BIRT must do it for "simple" data sources such as flat files or Java objects. BIRT allows sophisticated operations such as grouping on sums, percentages of overall totals and more.
  • Business Logic - Real-world data is seldom structured exactly as you'd like for a report. Many reports require business-specific logic to convert raw data into information useful for the user. If the logic is just for the report, you can script it using BIRT's JavaScript support. If your application already contains the logic, you can call into your existing Java code.
  • Presentation - Once the data is ready, you have a wide range of options for presenting it to the user. Tables, charts, text and more. A single data set can appear in multiple ways, and a single report can present data from multiple data sets 
    Designing a new report:
    Create a Report
     to create our first report:
  • Choose File→New→Report. The new report dialog appears.
  • Enter the file name
  • Click Next.
You can create a report in three ways: as a blank report, by using a BIRT-defined template, or by copying one of your report designs.