.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Interview Question >> OOPS >> Post New Question Subscribe to Interview Questions

Different between java and cpp?

Posted By :laptop charles     Posted Date :June 29, 2010    Points :10   Category :OOPS 
Java is purely object oriented language , cpp is not purely object oriented language.

You can also find related Interview Question to Different between java and cpp?  below: 

Can a .NET web application consume Java web service?

Yes Offcourse.Actually Webservices are independent to language. it depends on WSDL and SOAP. so any one can develope the Webservices anddisclose the wsdl and users can consume the webservices.wsdl and soap both are xml based.. and all languages having xml parsing
capability and access to http protocol will be able to work with Webservices. (More...)

How to add a combo box dynamically at run time in Java script?

document.forms[0]..options[index] new Option("Add text Value") (More...)

Java is "distributed" what does this means ?

Java is designed for the distributed environment of the internet, because it handles TCP/IP protocols. In fact accessing a resource using a URL is not much different from accessing a file.The original version of Java (Oak) included features for intraddress-spaces messaging.This allowed objects on two different computers to execute procedure remotely.Java has recently revived these interfaces in a package called ~Remote Method Invocation (RMI)~. This feature brings an unparalleled level of abstraction to client/server programming.

Thanks !!! (More...)

In a Java multithreading program, under what circumstances will you call the yield() method of a thread?

1, To give other runnable threads a chance to execute.
2, To start a new thread.
3, To terminate the current thread.
4, To stop the current thread for a specific time.

Answer : 1 (More...)

What is the result of below given line of code in Java Script? 5+4+'7'

The answer is 97.

As 5 and 4 are integer so total becomes 9 and it's add '7' to it as string so it becomes 97.

What is dynamic variable in java and where do we use them?

The variables that are initialized at run time is called as dynamic variable (More...)

Can you run the java program without main method?

A java applet application, a web application can run without main method. A Java program can run without using ' public static void main(String args[]) ' method by using a static block.

The static block gets executed soon after the class is loaded, even prior to the 'public static void main(String args[]) '. JVM searches for main method only after exiting from the static block. JVM throws an exception if main method is not found. To avoid throwing this exception we can use System.exit(0);

The following code depicts a class without main method; with only static block and System.exit(0).

class WithoutMainMethod {
System.out.println("This class has no public static void main(String args[]) ");
}. (More...)

Explain the ways to serialize the java object.

Object serialization could be used in different ways:

- Simple persistence of the object
- Reading from and writing to files
- RMI technology for communicating across hosts.

The encryption and decryption is left to the network transport. SSL or the like can be used when a secured channel is needed. (More...)

What is non static block in java?

Any code written between a { and a } is a non-static block.

for example:

// some code goes here
The non-static block code is executed when a new class is instantiated. It executes before the constructor's execution. Apart from initialization, any other execution like calculation could be given in the non-static block, as a constructor is used for initializing purpose. (More...)

Difference between a java object reference and c++ pointer.

The prime difference is that pointers are to locate the address of the primitive variables only, where as object reference locates the object in the heap. (More...)

Explain how to convert java file to jar files.

The following is the process:

- Type jar -cvf <.java file(s)>
where c stands for create, v stands for verbose and f indicates the file follows it, into which the archive to be stored. <.java file(s)> is the java files that are to be placed in the .jar file. (More...)

Describe how to use crystal reports in java.

nstall and run crystl32.cox file in \WINNT\System32 folder and specify the sub directory as 'crystal' as the output directory.

- Create an object of CrystalReport class.
- Invoke aboutBox() method - for confirmation whether it is loaded properly
- Establish the connection by using setConnect() method.
- Specify the output file format by using setReportFileName() method.
- Execute the query by using setSqlQuery() method.
- Set the number of copies of the report and the printer collation.
- Set the destination file using setDestination() method.
- Specify the file type using setPrintFileType () method.
- Invoke the method pritReport()

The following is the code example:

public class CrystalReportExample
private static final String CONNECT_STRING = "DSN=YourDsn";
private static final String REPORT_FILE_NAME = "FileName.rpt";
private static final String SQL_QUERY = "select * from YourTable";
private static final String PRINT_FILE = "YourNewReport.doc";

public static void main(String args[]) throws Exception
try {
crystal.CrystalReport report = new crystal.CrystalReport();
report.setConnect(CONNECT_STRING); // database connection
report.setReportFileName(REPORT_FILE_NAME); // name of the report file
report.setSQLQuery(SQL_QUERY); // query to get the data from the table
report.setPrinterCopies((short) 1); // number of copies of the report

// specifying the printer collating sequence

report.setDestination(crystal.DestinationConstants.crptToFile); // destination of the report
report.setPrintFileName(PRINT_FILE); // writing the report into the file
report.setPrintFileType(crystal.PrintFileTypeConstants.crptWinWord); // the type of the report file
report.printReport(); // printing the report onto the destination with the specified requirements
com.linar.jintegra.Cleaner.releaseAll(); // releasing all report resources.
}. (More...)

Explain why java doesn't support multiple inheritance.

Java does not support multiple inheritances. To avoid ambiguity problem - Diamonds of Death - and complexity of multiple inheritance.

The Diamond of Death is a problem without clarity. The Diamond problem is:

Two classes Two and Three inherit from class One. Class Four inherits from both Two and Three. When a method in Four invokes a method that is defined in One, and Two and Three have overridden that method in different way, the ambiguity and complexity occurs - through which class does it inherits: class Two or class Three?

Like wise if it is encouraged to have more than two classes to inherit, the ambiguity raises which leads to future conflict of applications. (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend