Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


Struts Tutorials
*Stuts TOC
*Apache Struts Introduction
* Struts Controller
* Struts Action Class
* Struts ActionFrom Class
* Using Struts HTML Tags
*Struts Validator Framework    
*Client Side Address Validation    
*Struts Tiles
*Struts DynaActionForm
*Struts File Upload
*Struts DataSource
Struts Resources
*Struts Books
*Struts Articles
*Struts Frameworks
*Struts IDE
*Struts Links
*Struts Presentations
*Struts Projects
*Struts Software
*Other Struts Tutorial
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail

Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Core Java Interview Question Page 26


Language Fundamentals

Question: How many number of non-public class definitions can a source file have A source file can contain unlimited number of non-public class definitions List primitive data types, there size and there range (min, max)


Data Type













































Question: What types of values does boolean variables take It only takes values true and false. Which primitive datatypes are signed.

Answer: All except char and Boolean

Question: Is char type signed or unsigned

Answer: char type is integral but unsigned. It range is 0 to 2^7-1

Question: What forms an integral literal can be

Answer: decimal, octal and hexadecimal, hence example it can be 28, 034 and 0x1c respectively

Question: What is the default value of Boolean

Answer: False

Question: Why is the main method static

Answer: So that it can be invoked without creating an instance of that class

Question: What is the difference between class variable, member variable and automatic(local) variable

Answer: class variable is a static variable and does not belong to instance of class but rather shared across all the instances
member variable belongs to a particular instance of class and can be called from any method of the class
automatic or local variable is created on entry to a method and has only method scope

Question: When are static and non static variables of the class initialized

Answer: The static variables are initialized when the class is loadedNon static variables are initialized just before the constructor is called

Question: When are automatic variable initialized

Answer: Automatic variable have to be initialized explicitly

Question: How is an argument passed in java, by copy or by reference

Answer: If the variable is primitive datatype then it is passed by copy.
If the variable is an object then it is passed by reference

Question: What is garbage collection

Answer: The runtime system keeps track of the memory that is allocated and is able to determine whether that memory is still useable. This work is usually done in background by a low-priority thread that is referred to as garbage collector. When the gc finds memory that is no longer accessible from any live thread it takes steps to release it back to the heap for reuse

Question: Does System.gc and Runtime.gc() guarantee garbage collection

Answer: No

Operators and assignment

Question: What are different types of operators in java

Answer: Uniary ++, --, +, -, |, ~, ()
Arithmetic *, /, %,+, -
Shift <<, >>, >>>
Comparison =, instanceof, = =,!=Bitwise &, ^, |Short Circuit &&, ||Ternary ?:Assignment =

Question: How does bitwise (~) operator work

Answer: It converts all the 1 bits in a binary value to 0s and all the 0 bits to 1s, e.g 11110000 coverts to 00001111

Question: What is a modulo operator %

Answer: This operator gives the value which is related to the remainder of a divisione.g x=7%4 gives remainder 3 as an answer

Question: Can shift operators be applied to float types.

Answer: No, shift operators can be applied only to integer or long types

Question: What happens to the bits that fall off after shifting

Answer: They are discarded

Question: What values of the bits are shifted in after the shift

Answer: In case of signed left shift >> the new bits are set to zero But in case of signed right shift it takes the value of most significant bit before the shift, that is if the most significant bit before shift is 0 it will introduce 0, else if it is 1, it will introduce 1


Ask programming questions?



Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

1 comments so far (post your own) View All Comments Latest 10 Comments:

Your answer to this quesiton is incorrect.

Question: How is an argument passed in java, by copy or by reference

Answer: If the variable is primitive datatype then it is passed by copy.
If the variable is an object then it is passed by reference

In java arguements are always passed by value. If it is an object that is being passed it really is the address of the object being passed by value. If you set the object to null inside of the called method it will not be set to null in the calling module thus it is not passed by reference.

Posted by Steven on Monday, 03.24.08 @ 02:37am | #53998

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name


Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright 2007. All rights reserved.

[an error occurred while processing this directive]