OnlyItellects

Name:
Location: Hyderabad, Andhra Pradesh, India

Thursday, December 09, 2004

quize

1. The name of the prison where gross human rights violations were reported in Iraq by US soldiers was (1) Baghdad Central prision (2) Abu Ghanb (3) Abu Sahara (4) Al Hasania
2. The term 'food security' as used in development and humanitarian aid implies (1) a situation in which people in a community at all times, have access to nutritious, safe, personally acceptable and culturally appropriate foods, produced in ways that are environmentally sound and socially just. (2) availability of ample storages and warehouses in a community, so that the food is secure. (3) availability of cultivable land to grow food crops. (4) as development takes places in a community, the food habits evolve and acquire a global character.
3. The NGO, 'cry' (child relief and you), was established in 1978 by (1) AmitAwasthi (2) Jagjit Singh (3) Rippan Kapur (4) Rohan Singh
4. The state to have recorded the most dramatic decadal growth in literacy since 1991 is (1) Orissa (2) Rajsathan (3) Madya Pradesh (4) Chattisgarh
5. Which state has the dubious distinction of recording the lowest sex ratio of 861 in census 2001. (1) Haryana (2) Bihar (3) Orissa (4) Rajasthan
6. Kerala has the highest literacy rate in India. Accord to census 2001 it hovered around (1) 99% (2) 90.92% (3) 95.6% (4) 88%
7. The top 3 states, in terms of literacy rates, in India are (1) Kerala, Tamilnadu, Andra Pradesh (2) Kerala, Mezoram, Lakhyadweep (3) Kerala, Mizoram, Tamilnadu (4) Kerala, Bengal, Tamilnadu
8. Department of' Ayush' (Ministry of health and family welfare) is to (1) upgrade and strengthen Indian system of medicine like Ayurveda, yoga, Homeopathy, Sidha etc. (2) address the needs of aged people (3) supervise education of prodigal brains in the field of medicine and utilize their services in R&D. (4) None of the above
9. The term 'Green GDP' implies (1) net value of GDP, deducting the amounts not realized, thus what is left is the currency, which is green in colour. (2) the GDP of Islamic countries. (3) the adjustment of traditional GDP, deducting resource and environmental costs in economic activities. (4) the GDP of fastest growing economies ,which causes envy to other nations, symbolically represented by colour green.

10. What is meant by 'trickle-down' theory of development? (1) Income generated in industrial sector at top will integrate the agriculture (subsistence) sector at the bottom by flow of income. (2) For development to become a reality, policies should focus on the marginalized sections, which have trickled down, and reached the bottom rungs of society. (3) Development should imply trickle down of power from center to grass root levels of panchayats. (4) None of the above
11. In India, estimation of incidence of poverty is on the basis of per capita calorie consumption, which amounts to (1) 2400 cal for rural and 2100 cal urban areas (2) 2100 cal for rural and 2400 cal urban areas (3) 2300 cal for rural and 2000 cal urban areas (4) 2000 cal for rural and 2300 cal urban areas
12. According to the planning commission statistics, the percentage of people below poverty line in India, in rural & urban areas respectively, is (1) 26% and 23.6% (2) 30% and 26% (3) 23% and 22% (4) 30% and 35%
13. The long-term target of 'National Population Policy 2000' is to achieve a stable population by the year (1) 2025 (2) 2010 (3) 2020 (4) 2045
14.'Operation Flood'is a (1) cooperative based movement pioneered by Dr. Kurien, for the production of milk. (2) the rescue mission army understakes protect civilians from the wrath of floods. (3) strategy to flood foreign markets with cheaper goods. (4) programe to evacuate submerged villagers in catchment areas, when flooded by river after construction of a dam.
15.The human development Index (HDI) of UNDP measures three basic dimensions of human development. These does NOT include. (1) Longevity and Health (2) IT in governance (3) Education and Knowledge (4) Decent standard of living
16.GDI is (1) Grand Development Index (2) Gross Development Initiative (3) Gender related Development Index (4) Goals of Development in India
17.Agriculture and allied sector recorded one of the highest growth rates in recent years in year 2003-04 owing to a good monsoon. It stood at (1) 9.5% (2) 9.1% (3) 8.9% (4) 8.5%
India is home to % of total of world's poor (1) 50% (2) 75% (3) 35% (4) 22%
NEERI - National Environment Engineering Institute, is situated at (1)Dehradun (2)Mussauri (3)Nagpur (4)Trivendrum
20.To encourage Agricultural diversification, the FM in budget 2004-05, took an initiative to replicate the milk cooperative success in Anand to other states too, in the area of (1) Horticulture (2) Floriculture (3) Pesiculture (4) Viticulture
21."Bhagidari', is the successful citizen partiapation initiative of govt. of (1) Maharashtra (2) Delhi (3) Gujrat (4) Uttar Pradesh
22.The expenditure, as a percentage of GDP, on education, in India is (1) 2.4% (2) 8% (3) 5% (4) 3.9%
23. The expenditure on health, as a percentage of GDP, in India is (1) 9% (2) 5% (3) 4% (4) 3%
24. Ironically, amidst the reports of starvation deaths, the food subsidy bill of India has climbed to all time high of (1) 27,746 crores (2) 40,000 crores (3) 1000 crores (4) 54,880 crores
25.As per the International Labour Organisation (ILO), what percentage of children (age group 10-14 years) are employed as child labour ? (1) 10% (2) 12% (3) 14% (4) 20%
26.The chairperson of the NGO, center for science and Environment (CSE) is (1) Sunita Narayan (2) Aruna Roy (3) Amrita Patel (4) Menka Gandhi
27.In the 10th plan, the target amount to be realized by disinvestments is set to be (1) Rs. 800 billion (2) Rs. 1000 billion (3) Rs. 1200 billion (4) Rs. 1500 billion
28. India has one of the highest corporate tax rates in the world, contrary to the global trend of declining corporate taxes. It stands at (1) 36.59% (2) 34.2% (3) 38.6% (4) 37%
29.In 1999,a state govt. introduced an Act, to impose a fine Rs.5000/- on person found spiting at public places. This state is (1) W. Bengal (2) Delhi (3) Goa (4) Kerala
30.Name the scheme designed to provide AIIMS like institutions in 6 backward states of Bihar Chattisgarh, MP, Orissa, Rajasthan and Uttaranchal. (1) Pradhan Mantri Chirayu Yoj na (2) Pradhan Mantri Sanjeevani Yojna (3) Pradhan Mantri Swasthya Sangathan Yojna (4) Pradhan Mantri Swasthya Suraksha Yojna
31.Demographic transition' is the transition form a stable population with highmortality and high fertility to a stable population with (1) low mortality and low fertility (2) high mortality and low fertility (3) low mortality and high fertility (4) None of the above
32.The 'Greenhouse Gases' does NOT include (1) CO2 (2) Chloro Flouro Carbon (3) Methane (4) Sulphur dioxide
33.International Day against Drug abuse is observed on (1) June 26 (2) October 10 (3) April 5 (4) January 2
34.The 'Golden Triangle' of world's primary opium and heroin producing areas, includes the countries of (1) Myanmar Thailand and Laos (2) India, Myanmar and Thailand (3) Myanmar, Laos, Cambodia (4) India, Myanmar, China
35.The limit on Foreign Direct Investment (FDI) in the sector of print media in India is (1) 74% (2) 15% (3) 51% (4) 26%
36.The 'Sarva Shiksha Abhiyan' (SSA) is a centrally sponsored scheme to universalize the
(1) higher education (2) secondary education (3) elementary education (4) Vocational education
37.In which town of southern India a fire accident in a school claimed more than 90 children?
(1) Kankudi (2) Kollam (3) Kumbakonam (4) Kovilpatti
38.The 'Dirty Dozen' is (1) the group of 12 countries, identified in Kyoto protocol, which account for maximum wastage and pollution (2) group of 12 nasty persistent organic pollutants (PoPs) which UNEP is advocating to be banned (3) the group of 12 popular tourist destinations, polluted by tourist over the years, identified by international tourism organization. (4) None of the above
39.The union cabinet approved implementation of PURA in 4130 rural clusters in next 5 years. PURA stands for (1) Pollution Under Control in Rural Areas (2) Providing Urban Amenities in Rural Areas (3) People in Urban areas to be settled in rural Areas. (4) Providing Useful amininities to rural Areas.
40.In Antyodaya Anna Yojna, implemented through the TPDS, identified families are provided wheat at the rate of Rs and rice at Rs a key. (1) 2 and 3 (2) 2 and 4 (3) 3 and 2 (4) 2 and 2

41.Which city and the industry-employing child labour is MISMATCHED? (1) Cutting and polishing diamonds - Jaipur (2) Glass manufacturing - Ferozpur (3) Carpet making - Tirupur (4) Textile mills - Kanpur
42.Chairperson of National Commission for Women is (1) Poornima Advani (2) Aruna Roy (3) Najma Heptullah (4) Mridula Sinha
43.Rajendra Singh is the founder of an origination, in the field watershed mgmt, which is transforming the landscape of Rajasthan. Name the origination (1) YuvaBharat (2) Mazdar Kissan Sangarsh Sangh (3) Tarun Bharat Sangh (4) None of the above
44.70% of the global total of HW infected live in the (1) Sub Saharan Africa (2) Indian Subcontinent (3) Northern Africa (4) USA and Canada
45.Agriculture employs around % of the total workforce of the country. (1) 65% (2) 30% (3) 50% (4) 80%
46.Agriculture accounts for around of GDP (2004). (1) 10% (2) 22% (3) 35% (4) 38%
47.The rationale behind 'Mid-day Meal' Scheme is (1) to address the problem of absenteeism of teachers in rural areas. (2) to reduce the drop outs in primary school as midday meal serves as an incentive to attend school regularly. (3) Mid day Meals scheme would bolster food for work Programme. (4) None of the above.
48.An index combining the unemployment rate and inflation rate, used to measure the political significance of the condition of the economy and consumer confidence, is known as (1) misery index (2) unemployment index (3) discomfort index (4) weak index
49.What is Tobin Tax related to? (1) Stock market transaction (2) Agriculture tax (3) Property tax (4) Public property tax

50. What is sex ratio? (1) Number of females per thousand males (2) Number of males per thousand females (3) Number of females per sq. km. (4) Number of females per 100 families
Answers Key 1.(1) 2.(1) 3.(3) 4.(2) 5.(1) 6.(2) 7.(2) 8.(1) 9.(3) 10.(1) 11.(1) 12.(1) 13.(4) 14.(1) 15.(2) 16.(3) 17.(2) 18.(4) 19.(3) 20.(1) 21.(2) 22.(4) 23.(1) 24.(1) 25.(3) 26.(1) 27.(1) 28.(1) 29.(3) 30.(4) 31.(1) 32.(4) 33.(1) 34.(1) 35.(4) 36.(3) 37.(3) 38.(2) 39.(2) 40.(1) 41.(4) 42.(1) 43.(3) 44.(1) 45.(1) 46.(2) 47.(2) 48.(1) 49.(1) 50.(1)
* Which city is known as the 'world's diamond centre'?# antwerp
*Which is the world's largest and flawless diamond?# de beer star in congo,weighs 203 carats
Which is the world's oldest diamond?hope,weighs 45.52 carats,in smithsonian institute in washington
About 80% of the world's natural diamonds are used for...industrial purpose
Which is the greenest car of 2004?honda civic gx
Which company invented a hybrid car with a self-parking feature?toyota
Which car can run 100 mph. on land and a cool 30 mph. on water?gibbs aquada
Name the manufacturer of Escape Hybrid.ford
Which car company is a leading manufacturer of marine engines?general motors
Who is the CEO of Microsoft? Steve Ballmer
Name the CEO of General Electric CompanyJeffrey R Immelt
Who heads oil major Exxon Mobil Corp?Lee R Raymond
Who is the Chairman of Nokia?Jorma Ollila
Who is the CEO of Time Warner Inc?Richard Parsons
who is the CEO and charmain of AOL?Jonathan F Miller
Which of these were the biggest donors for Bush's campaign?Morgan Stanley
3rd presidential candidate Ralph Nader targeted General Motors in which book?Unsafe at any speed
2004 US election is estimated to cost... $4 billion
Bush received his MBA from...Harvard business school in 1975
Who is the world's highest paid CEO? Reuben mark of colgate palmolive
Who is the world's topmost venture capitalist?Promod Haque
Which is the world's fastest supercomputer?NEC's SX-8
Which nation has the largest national debt?Brazil
Which company makes the world's costliest cellphones?vertu, a unit of Nokia
What was CII earlier known as? Confederation of Engineering Industry
CII is not present in one of these countries. Which one?Germany
Who is the current president of CII?sunil Kant Munjal
CII, along with the World Economic Forum, organises which annual meeting?India Economic Summit
How many companies are members of the CII?About 50,000
Who was called 'Neutron Jack'? Jack Welch , former GE chairman
Who was dubbed 'Chainsaw Al'?Albert Dunlap
Who earned the nickname 'Jac the Knife'?Jacques Nasser , former CEO of ford motors
Who earned the moniker 'Mr Fix-it'?Nick Scheele ,President ford motors
Who was called 'The CEO Who Wasn't There'?Jeffery Skilling,former CEO of enron corporation
Who is the official time keeper of Beijing Olympics?Omega
Who introduced the world's first quartz alarm clock?seiko
Titan is a joint venture between...Tata Group and Tamil Nadu Industrial Development Corp
The Swatch group was formed through the merger of...2 companies,ASUAG and SSIH
Which FMCG major is also famous for the world's largest clock?Colgate,on Hudson river in Jersey
Which publishing group owns Star News?ABP,kolkatta based firm
US President Theodore Roosevelt was a partner of which publishing house?Penguin
Which British politician also owned a publishing house? Harold Macmillan
Who introduced the first customised publishing system?Mc Graw Hill
What do the first three letters of SUN Microsystems stand for? Stanford University Network
Who created the first Indian product, a customer e-mail manager, that was put up on Microsoft's Site Builder Network site?Pradeep singh
What is the name of the dog in the HMV logo?Nipper
Which film company was the first ever in Bollywood to raise money through an initial public offering?Mukta Arts
Taj Television Limited owns which 24-hour channel?Ten sports
Which is the world's first low-cost airline?southwest Airlines(US)
Which is Europe's largest budget airline? easyJet
Where is Air Andaman based?Thailand
Tiger Airways belongs to which country?singapore,will fly from singapore to bangkok
Valuair is Singapore's first budget airline. Indonesia's low-cost airline is Lion Air AirAsia.
Name Richard Branson's Australia-based airline? Virgin Blue
Who introduced the DynaTAC cell phones?Motorola
When was Unilever created?1930
Communication unlimited is the tagline of which company?Siemens
Froot Loops belong to which company?Kellogg's
Bata Shoes originated in: Czechoslovakia , in 1894
Since when is Xerox sponsoring Olympic Games?1964 Olympic Winter Games, Austria
Who is touted as the biggest national sponsor in Olympic history?ALPHA Bank
How many companies are TOP Partners for Olympic 2004 11TOP stands for The Olympic Partner Programme. Created in 1985, the TOP programme, managed by the IOC, is the only sponsorship with the exclusive worldwide marketing rights to both Winter and Summer Games. The TOP Partners for ATHENS 2004 are: Coca-Cola (non-alcoholic beverages); John Hancock (life insurance); Kodak (photography); McDonald's (retail food service), Panasonic (Audio/TV/Video Equipment), Samsung (Wireless Communication Equipment), Atos Origin (IT), Sports Illustrated (Periodicals/ Newspapers / Magazines), Swatch (group of Swiss watch makers), Visa (Consumer Payment Services), Xerox (Document Publishing, Processing).
Which company is the official supplier of cars of ATHENS 2004? Hyundai
What are diamonds composed of?carbon
In which country was diamond first mined?India
Which city first started diamond trading?Venice
Which is known as the Diamond City? Antwerp
Which is the world's oldest hotel?Hoshi Ryo
When a doctor by the name John Stythe Pemberton mixed up a concoction of medicinal syrup in May in 1886, which company was about to be born?coca cola
Before Microsoft, Bill Gates and Paul Allen had floated another company. What was it called?traf-o-data
Which cosmetics giant did Eugène Schueller found?L'Oreal
Since 1946, this company has been a leading food brand. Its ad campaign is as famous as it is and is set to enter the Guinness Book of World Records as the longest running ad campaign. The company's name means 'priceless'. Name the company.Amul
Frank Seiberling founded which tyre firm?GoodYear
When was Income-Tax introduced?1404
What, in India, is regarded as the first authoritative text on public finances? Arthasastra
India's first I-T Act came into being in..?1860
Italian dictator Benitto Mussolini introduced a novel tax. Name it.Bachelor Tax
What is the full form of CBDT? Central Board of Direct Taxes
Who are the founders of Pizza Hut?Dan and Frank Carney in 1958 in Kansas,USA
When was the first Domino's Pizza store set up?Thomas S Monaghan founded Domino's Pizza in 1960
Who founded McDonald's Restaurant?Richard and Maurice McDonald founded McDonald's Restaurant in 1948 in San Bernadino, California.
Name the founders of Burger King.In 1954, James McLamore and David Edgerton opened their first Burger King restaurant in Miami, Florida.
Col. H Sanders founded which fast food chain?KFC
Answers to Punchlines:
1. Which brand had the ad slogan 'Tomorrow is mine'- Reebok
2. 'Live every moment' was the tagline of which product- Airtel
3. 'What are you made of?' - is the tagline of which Swiss watch- TAGHeuer
4. The 'Joy of flying' is which airline- Jet Airways
5. Who has the punchline -- 'Red is in your Head'- Red FM



java interview

java interview
http://www.javacamp.org/jobinterview.html
What is garbage collection? What is the process that is responsible for doing that in java? - Reclaiming the unused memory by the invalid objects. Garbage collector is responsible for this process What kind of thread is the Garbage collector thread? - It is a daemon thread.
What is a daemon thread? - These are the threads which can run without user intervention. The JVM can exit when there are daemon thread by killing them abruptly. How will you invoke any external process in Java? - Runtime.getRuntime().exec(….) What is the finalize method do? - Before the invalid objects get garbage collected, the JVM give the user a chance to clean up some resources before it got garbage collected. What is mutable object and immutable object? - If a object value is changeable then we can call it as Mutable object. (Ex., StringBuffer, …) If you are not allowed to change the value of an object, it is immutable object. (Ex., String, Integer, Float, …) What is the basic difference between string and stringbuffer object? - String is an immutable object. StringBuffer is a mutable object. What is the purpose of Void class? - The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the primitive Java type void. What is reflection? - Reflection allows programmatic access to information about the fields, methods and constructors of loaded classes, and the use reflected fields, methods, and constructors to operate on their underlying counterparts on objects, within security restrictions. What is the base class for Error and Exception? - Throwable What is the byte range? -128 to 127 What is the implementation of destroy method in java.. is it native or java code? - This method is not implemented. What is a package? - To group set of classes into a single unit is known as packaging. Packages provides wide namespace ability. What are the approaches that you will follow for making a program very efficient? - By avoiding too much of static methods avoiding the excessive and unnecessary use of synchronized methods Selection of related classes based on the application (meaning synchronized classes for multiuser and non-synchronized classes for single user) Usage of appropriate design patterns Using cache methodologies for remote invocations Avoiding creation of variables within a loop and lot more. What is a DatabaseMetaData? - Comprehensive information about the database as a whole. What is Locale? - A Locale object represents a specific geographical, political, or cultural region How will you load a specific locale? - Using ResourceBundle.getBundle(…); What is JIT and its use? - Really, just a very fast compiler… In this incarnation, pretty much a one-pass compiler – no offline computations. So you can’t look at the whole method, rank the expressions according to which ones are re-used the most, and then generate code. In theory terms, it’s an on-line problem. Is JVM a compiler or an interpreter? - Interpreter When you think about optimization, what is the best way to findout the time/memory consuming process? - Using profiler What is the purpose of assert keyword used in JDK1.4.x? - In order to validate certain expressions. It effectively replaces the if block and automatically throws the AssertionError on failure. This keyword should be used for the critical arguments. Meaning, without that the method does nothing. How will you get the platform dependent values like line separator, path separator, etc., ? - Using Sytem.getProperty(…) (line.separator, path.separator, …) What is skeleton and stub? what is the purpose of those? - Stub is a client side representation of the server, which takes care of communicating with the remote server. Skeleton is the server side representation. But that is no more in use… it is deprecated long before in JDK. What is the final keyword denotes? - final keyword denotes that it is the final implementation for that method or variable or class. You can’t override that method/variable/class any more. What is the significance of ListIterator? - You can iterate back and forth. What is the major difference between LinkedList and ArrayList? - LinkedList are meant for sequential accessing. ArrayList are meant for random accessing. What is nested class? - If all the methods of a inner class is static then it is a nested class. What is inner class? - If the methods of the inner class can only be accessed via the instance of the inner class, then it is called inner class. What is composition? - Holding the reference of the other class within some other class is known as composition. What is aggregation? - It is a special type of composition. If you expose all the methods of a composite class and route the method call to the composite method through its reference, then it is called aggregation. What are the methods in Object? - clone, equals, wait, finalize, getClass, hashCode, notify, notifyAll, toString Can you instantiate the Math class? - You can’t instantiate the math class. All the methods in this class are static. And the constructor is not public. What is singleton? - It is one of the design pattern. This falls in the creational pattern of the design pattern. There will be only one instance for that entire JVM. You can achieve this by having the private constructor in the class. For eg., public class Singleton { private static final Singleton s = new Singleton(); private Singleton() { } public static Singleton getInstance() { return s; } // all non static methods … } What is DriverManager? - The basic service to manage set of JDBC drivers. What is Class.forName() does and how it is useful? - It loads the class into the ClassLoader. It returns the Class. Using that you can get the instance ( “class-instance".newInstance() ).
http://www.techinterviews.com/index.php?p=144
Core Java Interview Questions
Question: What is transient variable?Answer: Transient variable can't be serialize. For example if a variable is declared as transient in a Serializable class and the class is written to an ObjectStream, the value of the variable can't be written to the stream instead when the class is retrieved from the ObjectStream the value of the variable becomes null. Question: Name the containers which uses Border Layout as their default layout?Answer: Containers which uses Border Layout as their default are: window, Frame and Dialog classes. Question: What do you understand by Synchronization?Answer: Synchronization is a process of controlling the access of shared resources by the multiple threads in such a manner that only one thread can access one resource at a time. In non synchronized multithreaded application, it is possible for one thread to modify a shared object while another thread is in the process of using or updating the object's value. Synchronization prevents such type of data corruption.E.g. Synchronizing a function:public synchronized void Method1 () { // Appropriate method-related code. }E.g. Synchronizing a block of code inside a function:public myFunction (){ synchronized (this) { // Synchronized code here. }} Question: What is Collection API?Answer: The Collection API is a set of classes and interfaces that support operation on collections of objects. These classes and interfaces are more flexible, more powerful, and more regular than the vectors, arrays, and hashtables if effectively replaces. Example of classes: HashSet, HashMap, ArrayList, LinkedList, TreeSet and TreeMap.Example of interfaces: Collection, Set, List and Map. Question: Is Iterator a Class or Interface? What is its use?Answer: Iterator is an interface which is used to step through the elements of a Collection. Question: What is similarities/difference between an Abstract class and Interface?Answer: Differences are as follows: Interfaces provide a form of multiple inheritance. A class can extend only one other class. Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods, etc. A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class. Interfaces are slow as it requires extra indirection to to find corresponding method in in the actual class. Abstract classes are fast. Similarities:
Neither Abstract classes or Interface can be instantiated. Question: How to define an Abstract class?Answer: A class containing abstract method is called Abstract class. An Abstract class can't be instantiated. Example of Abstract class:abstract class testAbstractClass { protected String myString; public String getMyString() { return myString; } public abstract string anyAbstractFunction();} Question: How to define an Interface?Answer: In Java Interface defines the methods but does not implement them. Interface can include constants. A class that implements the interfaces is bound to implement all the methods defined in Interface.Emaple of Interface:
public interface sampleInterface { public void functionOne();
public long CONSTANT_ONE = 1000; } Question: Explain the user defined Exceptions?Answer: User defined Exceptions are the separate Exception classes defined by the user for specific purposed. An user defined can created by simply sub-classing it to the Exception class. This allows custom exceptions to be generated (using throw) and caught in the same way as normal exceptions. Example:class myCustomException extends Exception { // The class simply has to exist to be an exception } Question: Explain the new Features of JDBC 2.0 Core API?Answer: The JDBC 2.0 API includes the complete JDBC API, which includes both core and Optional Package API, and provides inductrial-strength database computing capabilities. New Features in JDBC 2.0 Core API:
Scrollable result sets- using new methods in the ResultSet interface allows programmatically move the to particular row or to a position relative to its current position JDBC 2.0 Core API provides the Batch Updates functionality to the java applications. Java applications can now use the ResultSet.updateXXX methods. New data types - interfaces mapping the SQL3 data types Custom mapping of user-defined types (UTDs) Miscellaneous features, including performance hints, the use of character streams, full precision for java.math.BigDecimal values, additional security, and support for time zones in date, time, and timestamp values.
Question: Explain garbage collection?Answer: Garbage collection is one of the most important feature of Java. Garbage collection is also called automatic memory management as JVM automatically removes the unused variables/objects (value is null) from the memory. User program cann't directly free the object from memory, instead it is the job of the garbage collector to automatically free the objects that are no longer referenced by a program. Every class inherits finalize() method from java.lang.Object, the finalize() method is called by garbage collector when it determines no more references to the object exists. In Java, it is good idea to explicitly assign null into a variable when no more in use. I Java on calling System.gc() and Runtime.gc(), JVM tries to recycle the unused objects, but there is no guarantee when all the objects will garbage collected. Question: How you can force the garbage collection?Answer: Garbage collection automatic process and can't be forced. Question: What is OOPS?Answer: OOP is the common abbreviation for Object-Oriented Programming. Question: Describe the principles of OOPS.Answer: There are three main principals of oops which are called Polymorphism, Inheritance and Encapsulation. Question: Explain the Encapsulation principle.Answer: Encapsulation is a process of binding or wrapping the data and the codes that operates on the data into a single entity. This keeps the data safe from outside interface and misuse. One way to think about encapsulation is as a protective wrapper that prevents code and data from being arbitrarily accessed by other code defined outside the wrapper. Question: Explain the Inheritance principle.Answer: Inheritance is the process by which one object acquires the properties of another object. Question: Explain the Polymorphism principle.Answer: The meaning of Polymorphism is something like one name many forms. Polymorphism enables one entity to be used as as general category for different types of actions. The specific action is determined by the exact nature of the situation. The concept of polymorphism can be explained as "one interface, multiple methods". Question: Explain the different forms of Polymorphism.Answer: From a practical programming viewpoint, polymorphism exists in three distinct forms in Java: Method overloading Method overriding through inheritance Method overriding through the Java interface Question: What are Access Specifiers available in Java?Answer: Access specifiers are keywords that determines the type of access to the member of a class. These are: Public Protected Private Defaults Question: Describe the wrapper classes in Java.Answer: Wrapper class is wrapper around a primitive data type. An instance of a wrapper class contains, or wraps, a primitive value of the corresponding type.
Following table lists the primitive types and the corresponding wrapper classes:
Primitive Wrapper boolean java.lang.Boolean byte java.lang.Byte char java.lang.Character double java.lang.Double float java.lang.Float int java.lang.Integer long java.lang.Long short java.lang.Short void java.lang.Void
http://roseindia.net/interviewquestions/jakartastrutsinterviewquestions.shtml
Q: What is Jakarta Struts Framework?A: Jakarta Struts is open source implementation of MVC (Model-View-Controller) pattern for the development of web based applications. Jakarta Struts is robust architecture and can be used for the development of application of any size. Struts framework makes it much easier to design scalable, reliable Web applications with Java. Q: What is ActionServlet?A: The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of controller. All the requests to the server goes through the controller. Controller is responsible for handling all the requests. Q: How you will make available any Message Resources Definitions file to the Struts Framework Environment?A: Message Resources Definitions file are simple .properties files and these files contains the messages that can be used in the struts project. Message Resources Definitions files can be added to the struts-config.xml file through tag.Example: Q: What is Action Class?A: The Action Class is part of the Model and is a wrapper around the business logic. The purpose of Action Class is to translate the HttpServletRequest to the business logic. To use the Action, we need to Subclass and overwrite the execute() method. In the Action Class all the database/business processing are done. It is advisable to perform all the database related stuffs in the Action Class. The ActionServlet (commad) passes the parameterized class to Action Form using the execute() method. The return type of the execute method is ActionForward which is used by the Struts Framework to forward the request to the file as per the value of the returned ActionForward object. Q: Write code of any Action Class?A: Here is the code of Action Class that returns the ActionForward object.TestAction.java package roseindia.net;
import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionForward;import org.apache.struts.action.ActionMapping;
public class TestAction extends Action{ public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{ return mapping.findForward("testAction"); }}
Q: What is ActionForm?A: An ActionForm is a JavaBean that extends org.apache.struts.action.ActionForm. ActionForm maintains the session state for web application and the ActionForm object is automatically populated on the server side with data entered from a form on the client side. Q: What is Struts Validator Framework?A: Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used validate the form data on the client browser. Server side validation of form can be accomplished by sub classing your From Bean with DynaValidatorForm class. The Validator framework was developed by David Winterfeldt as third-party add-on to Struts. Now the Validator framework is a part of Jakarta Commons project and it can be used with or without Struts. The Validator framework comes integrated with the Struts Framework and can be used without doing any extra settings.
Q. Give the Details of XML files used in Validator Framework?A: The Validator Framework uses two XML configuration files validator-rules.xml and validation.xml. The validator-rules.xml defines the standard validation routines, these are reusable and used in validation.xml. to define the form specific validations. The validation.xml defines the validations applied to a form bean.
Q. How you will display validation fail errors on jsp page?A: Following tag displays all the errors:
Q. How you will enable front-end validation based on the xml in validation.xml?A: The tag to allow front-end validation based on the xml in validation.xml. For example the code: generates the client side java script for the form "logonForm" as defined in the validation.xml file. The when added in the jsp file generates the client site validation script.
http://www.sap-img.com/java/java-interview-questions.htm
only quest......
What is the diffrence between an Abstract class and Interface ? What is user defined exception ? What do you know about the garbate collector ? What is the difference between C++ & Java ? Explain RMI Architecture? How do you communicate in between Applets & Servlets ? What is the use of Servlets ? What is JDBC? How do you connect to the Database ? In an HTML form I have a Button which makes us to open another page in 15 seconds. How will do you that ? What is the difference between Process and Threads ? What is the difference between RMI & Corba ? What are the services in RMI ? How will you initialize an Applet ? What is the order of method invocation in an Applet ? When is update method called ? How will you pass values from HTML page to the Servlet ? Have you ever used HashTable and Dictionary ? How will you communicate between two Applets ? What are statements in JAVA ? What is JAR file ? What is JNI ? What is the base class for all swing components ? What is JFC ? What is Difference between AWT and Swing ? Considering notepad/IE or any other thing as process, What will happen if you start notepad or IE 3 times? Where 3 processes are started or 3 threads are started ? How does thread synchronization occurs inside a monitor ? How will you call an Applet using a Java Script function ? Is there any tag in HTML to upload and download files ? Why do you Canvas ? How can you push data from an Applet to Servlet ? What are 4 drivers available in JDBC ? How you can know about drivers and database information ? If you are truncated using JDBC, How can you know ..that how much data is truncated ? And What situation , each of the 4 drivers used ? How will you perform transaction using JDBC ? In RMI, server object first loaded into the memory and then the stub reference is sent to the client ? or whether a stub reference is directly sent to the client ? Suppose server object is not loaded into the memory, and the client request for it , what will happen? What is serialization ? Can you load the server object dynamically? If so, what are the major 3 steps involved in it ? What is difference RMI registry and OSAgent ? To a server method, the client wants to send a value 20, with this value exceeds to 20,. a message should be sent to the client ? What will you do for achieving for this ? What are the benefits of Swing over AWT ? Where the CardLayout is used ? What is the Layout for ToolBar ? What is the difference between Grid and GridbagLayout ? How will you add panel to a Frame ? What is the corresponding Layout for Card in Swing ? What is light weight component ? Can you run the product development on all operating systems ? What is the webserver used for running the Servlets ? What is Servlet API used for conneting database ? What is bean ? Where it can be used ? What is difference in between Java Class and Bean ? Can we send object using Sockets ? What is the RMI and Socket ? How to communicate 2 threads each other ? What are the files generated after using IDL to Java Compilet ? What is the protocol used by server and client ? Can I modify an object in CORBA ? What is the functionality stubs and skeletons ? What is the mapping mechanism used by Java to identify IDL language ? Diff between Application and Applet ? What is serializable Interface ? What is the difference between CGI and Servlet ? What is the use of Interface ? Why Java is not fully objective oriented ? Why does not support multiple Inheritance ? What it the root class for all Java classes ? What is polymorphism ? Suppose If we have variable ' I ' in run method, If I can create one or more thread each thread will occupy a separate copy or same variable will be shared ? In servlets, we are having a web page that is invoking servlets username and password ? which is cheks in the database ? Suppose the second page also If we want to verify the same information whethe it will connect to the database or it will be used previous information? What are virtual functions ? Write down how will you create a binary Tree ? What are the traverses in Binary Tree ? Write a program for recursive Traverse ? What are session variable in Servlets ? What is client server computing ? What is Constructor and Virtual function? Can we call Virtual funciton in a constructor ? Why we use OOPS concepts? What is its advantage ? What is the middleware ? What is the functionality of Webserver ? Why Java is not 100 % pure OOPS ? ( EcomServer ) When we will use an Interface and Abstract class ? What is an RMI? How will you pass parameters in RMI ? Why u serialize? What is the exact difference in between Unicast and Multicast object ? Where we will use ? What is the main functionality of the Remote Reference Layer ? How do you download stubs from a Remote place ? What is the difference in between C++ and Java ? can u explain in detail ? I want to store more than 10 objects in a remote server ? Which methodology will follow ? What is the main functionality of the Prepared Statement ? What is meant by static query and dynamic query ? What are the Normalization Rules ? Define the Normalization ? What is meant by Servelet? What are the parameters of the service method ? What is meant by Session ? Tell me something about HTTPSession Class ? How do you invoke a Servelt? What is the difference in between doPost and doGet methods ? What is the difference in between the HTTPServlet and Generic Servlet ? Expalin their methods ? Tell me their parameter names also ? Have you used threads in Servelet ? Write a program on RMI and JDBC using StoredProcedure ? How do you sing an Applet ? In a Container there are 5 components. I want to display the all the components names, how will you do that one ? Why there are some null interface in java ? What does it mean ? Give me some null interfaces in JAVA ? Tell me the latest versions in JAVA related areas ? What is meant by class loader ? How many types are there? When will we use them ? How do you load an Image in a Servlet ? What is meant by flickering ? What is meant by distributed Application ? Why we are using that in our applications ? What is the functionality of the stub ? Have you used any version control ? What is the latest version of JDBC ? What are the new features are added in that ? Explain 2 tier and 3 -tier Architecture ? What is the role of the webserver ? How have you done validation of the fileds in your project ? What is the main difficulties that you are faced in your project ? What is meant by cookies ? Explain ? Problem faced in your earlier project How OOPS concept is achieved in Java Features for using Java How does Java 2.0 differ from Java 1.0 Public static void main – Explain What are command line arguments Explain about the three-tier model Difference between String & StringBuffer Wrapper class. Is String a Wrapper Class What are the restriction for static method Purpose of the file class Default modifier in Interface Difference between Interface & Abstract class Can abstract be declared as Final Can we declare variables inside a method as Final Variables What is the package concept and use of package How can a dead thread be started Difference between Applet & Application Life cycle of the Applet Can Applet have constructors Differeence between canvas class & graphics class Explain about Superclass & subclass Difference between TCP & UDP What is AppletStub Explain Stream Tokenizer What is the difference between two types of threads Checked & Unchecked exception Use of throws exception What is finally in exception handling Vector class What will happen to the Exception object after exception handling Two types of multi-tasking Two ways to create the thread Synchronization I/O Filter How can you retrieve warnings in JDBC Can applet in different page communicate with each other Four driver Manager Features of JDBC 20 Explain about stored procedures Servlet Life cycle Why do you go for servlet rather than CGI How to generate skeleton & Stub classes Explain lazy activation Firewalls in RMI
forum 4r java interview quest.........................http://forum.java.sun.com/thread.jspa?threadID=572597&tstart=30
http://www.onesmartclick.com/interviews/interviews-programming.html
Java Language Questions
--------------------------------------------------------------------------------
What is a platform? A platform is the hardware or software environment in which a program runs. Most platforms can be described as a combination of the operating system and hardware, like Windows 2000/XP, Linux, Solaris, and MacOS.
--------------------------------------------------------------------------------
What is the main difference between Java platform and other platforms? The Java platform differs from most other platforms in that it's a software-only platform that runs on top of other hardware-based platforms.
The Java platform has two components:
The Java Virtual Machine (Java VM) The Java Application Programming Interface (Java API)
--------------------------------------------------------------------------------
What is the Java Virtual Machine? The Java Virtual Machine is a software that can be ported onto various hardware-based platforms.
--------------------------------------------------------------------------------
What is the Java API? The Java API is a large collection of ready-made software components that provide many useful capabilities, such as graphical user interface (GUI) widgets.
--------------------------------------------------------------------------------
What is the package? The package is a Java namespace or part of Java libraries. The Java API is grouped into libraries of related classes and interfaces; these libraries are known as packages.
--------------------------------------------------------------------------------
What is native code? The native code is code that after you compile it, the compiled code runs on a specific hardware platform.
--------------------------------------------------------------------------------
Is Java code slower than native code? Not really. As a platform-independent environment, the Java platform can be a bit slower than native code. However, smart compilers, well-tuned interpreters, and just-in-time bytecode compilers can bring performance close to that of native code without threatening portability.
--------------------------------------------------------------------------------
What is the serialization? The serialization is a kind of mechanism that makes a class or a bean persistence by having its properties or fields and state information saved and restored to and from storage.
--------------------------------------------------------------------------------
How to make a class or a bean serializable? By implementing either the java.io.Serializable interface, or the java.io.Externalizable interface. As long as one class in a class's inheritance hierarchy implements Serializable or Externalizable, that class is serializable.
--------------------------------------------------------------------------------
How many methods in the Serializable interface? There is no method in the Serializable interface. The Serializable interface acts as a marker, telling the object serialization tools that your class is serializable.
--------------------------------------------------------------------------------
How many methods in the Externalizable interface? There are two methods in the Externalizable interface. You have to implement these two methods in order to make your class externalizable. These two methods are readExternal() and writeExternal().
--------------------------------------------------------------------------------
What is the difference between Serializalble and Externalizable interface? When you use Serializable interface, your class is serialized automatically by default. But you can override writeObject() and readObject() two methods to control more complex object serailization process. When you use Externalizable interface, you have a complete control over your class's serialization process.
--------------------------------------------------------------------------------
What is a transient variable? A transient variable is a variable that may not be serialized. If you don't want some field to be serialized, you can mark that field transient or static.
--------------------------------------------------------------------------------
Which containers use a border layout as their default layout? The Window, Frame and Dialog classes use a border layout as their default layout.
--------------------------------------------------------------------------------
How are Observer and Observable used? Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects.
--------------------------------------------------------------------------------
What is synchronization and why is it important? With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value. This often causes dirty data and leads to significant errors.
--------------------------------------------------------------------------------
What are synchronized methods and synchronized statements? Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.
--------------------------------------------------------------------------------
What are three ways in which a thread can enter the waiting state? A thread can enter the waiting state by invoking its sleep() method, by blocking on I/O, by unsuccessfully attempting to acquire an object's lock, or by invoking an object's wait() method. It can also enter the waiting state by invoking its (deprecated) suspend() method.
--------------------------------------------------------------------------------
Can a lock be acquired on a class? Yes, a lock can be acquired on a class. This lock is acquired on the class's Class object.
--------------------------------------------------------------------------------
What's new with the stop(), suspend() and resume() methods in JDK 1.2? The stop(), suspend() and resume() methods have been deprecated in JDK 1.2.
--------------------------------------------------------------------------------
What is the preferred size of a component? The preferred size of a component is the minimum component size that will allow the component to display normally.
--------------------------------------------------------------------------------
What method is used to specify a container's layout? The setLayout() method is used to specify a container's layout.
--------------------------------------------------------------------------------
Which containers use a FlowLayout as their default layout? The Panel and Applet classes use the FlowLayout as their default layout.
--------------------------------------------------------------------------------
What is thread? A thread is an independent path of execution in a system.
--------------------------------------------------------------------------------
What is multithreading? Multithreading means various threads that run in a system.
--------------------------------------------------------------------------------
How does multithreading take place on a computer with a single CPU? The operating system's task scheduler allocates execution time to multiple tasks. By quickly switching between executing tasks, it creates the impression that tasks execute sequentially.
--------------------------------------------------------------------------------
How to create multithread in a program? You have two ways to do so. First, making your class "extends" Thread class. Second, making your class "implements" Runnable interface. Put jobs in a run() method and call start() method to start the thread.
--------------------------------------------------------------------------------
Can Java object be locked down for exclusive use by a given thread? Yes. You can lock an object by putting it in a "synchronized" block. The locked object is inaccessible to any thread other than the one that explicitly claimed it.
--------------------------------------------------------------------------------
Can each Java object keep track of all the threads that want to exclusively access to it? Yes.
--------------------------------------------------------------------------------
What state does a thread enter when it terminates its processing? When a thread terminates its processing, it enters the dead state.
--------------------------------------------------------------------------------
What invokes a thread's run() method? After a thread is started, via its start() method of the Thread class, the JVM invokes the thread's run() method when the thread is initially executed.
--------------------------------------------------------------------------------
What is the purpose of the wait(), notify(), and notifyAll() methods? The wait(),notify(), and notifyAll() methods are used to provide an efficient way for threads to communicate each other.
--------------------------------------------------------------------------------
What are the high-level thread states? The high-level thread states are ready, running, waiting, and dead.
--------------------------------------------------------------------------------
What is the Collections API? The Collections API is a set of classes and interfaces that support operations on collections of objects.
--------------------------------------------------------------------------------
What is the List interface? The List interface provides support for ordered collections of objects.
--------------------------------------------------------------------------------
How does Java handle integer overflows and underflows? It uses those low order bytes of the result that can fit into the size of the type allowed by the operation.
--------------------------------------------------------------------------------
What is the Vector class? The Vector class provides the capability to implement a growable array of objects
--------------------------------------------------------------------------------
What modifiers may be used with an inner class that is a member of an outer class? A (non-local) inner class may be declared as public, protected, private, static, final, or abstract.
--------------------------------------------------------------------------------
If a method is declared as protected, where may the method be accessed? A protected method may only be accessed by classes or interfaces of the same package or by subclasses of the class in which it is declared.
--------------------------------------------------------------------------------
What is an Iterator interface? The Iterator interface is used to step through the elements of a Collection.
--------------------------------------------------------------------------------
How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters? Unicode requires 16 bits and ASCII require 7 bits. Although the ASCII character set uses only 7 bits, it is usually represented as 8 bits. UTF-8 represents characters using 8, 16, and 18 bit patterns. UTF-16 uses 16-bit and larger bit patterns.
--------------------------------------------------------------------------------
What is the difference between yielding and sleeping? When a task invokes its yield() method, it returns to the ready state. When a task invokes its sleep() method, it returns to the waiting state.
--------------------------------------------------------------------------------
Is sizeof a keyword? The sizeof operator is not a keyword.
--------------------------------------------------------------------------------
What are wrapped classes? Wrapped classes are classes that allow primitive types to be accessed as objects.
--------------------------------------------------------------------------------
Does garbage collection guarantee that a program will not run out of memory? No, it doesn't. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection
--------------------------------------------------------------------------------
What is the difference between preemptive scheduling and time slicing? Under preemptive scheduling, the highest priority task executes until it enters the waiting or dead states or a higher priority task comes into existence. Under time slicing, a task executes for a predefined slice of time and then reenters the pool of ready tasks. The scheduler then determines which task should execute next, based on priority and other factors.
--------------------------------------------------------------------------------
Name Component subclasses that support painting. The Canvas, Frame, Panel, and Applet classes support painting.
--------------------------------------------------------------------------------
What is a native method? A native method is a method that is implemented in a language other than Java.
--------------------------------------------------------------------------------
How can you write a loop indefinitely? for(;;)--for loop; while(true)--always true, etc.
--------------------------------------------------------------------------------
Can an anonymous class be declared as implementing an interface and extending a class? An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.
--------------------------------------------------------------------------------
What is the purpose of finalization? The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.
--------------------------------------------------------------------------------
Which class is the superclass for every class. Object
--------------------------------------------------------------------------------
What is the difference between the Boolean & operator and the && operator? If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is evaluated. The && operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped. Operator & has no chance to skip both sides evaluation and && operator does. If asked why, give details as above.
--------------------------------------------------------------------------------
What is the GregorianCalendar class? The GregorianCalendar provides support for traditional Western calendars.
--------------------------------------------------------------------------------
What is the SimpleTimeZone class? The SimpleTimeZone class provides support for a Gregorian calendar.
--------------------------------------------------------------------------------
Which Container method is used to cause a container to be laid out and redisplayed? validate()
--------------------------------------------------------------------------------
What is the Properties class? The properties class is a subclass of Hashtable that can be read from or written to a stream. It also provides the capability to specify a set of default values to be used.
--------------------------------------------------------------------------------
What is the purpose of the Runtime class? The purpose of the Runtime class is to provide access to the Java runtime system.
--------------------------------------------------------------------------------
What is the purpose of the System class? The purpose of the System class is to provide access to system resources.
--------------------------------------------------------------------------------
What is the purpose of the finally clause of a try-catch-finally statement? The finally clause is used to provide the capability to execute code no matter whether or not an exception is thrown or caught.
--------------------------------------------------------------------------------
What is the Locale class? The Locale class is used to tailor program output to the conventions of a particular geographic, political, or cultural region.
--------------------------------------------------------------------------------
What must a class do to implement an interface? It must provide all of the methods in the interface and identify the interface in its implements clause.
--------------------------------------------------------------------------------
What is an abstract method? An abstract method is a method whose implementation is deferred to a subclass. Or, a method that has no implementation (an interface of a method).
--------------------------------------------------------------------------------
What is a static method? A static method is a method that belongs to the class rather than any object of the class and doesn't apply to an object or even require that any objects of the class have been instantiated.
--------------------------------------------------------------------------------
What is a protected method? A protected method is a method that can be accessed by any method in its package and inherited by any subclass of its class.
--------------------------------------------------------------------------------
What is the difference between a static and a non-static inner class? A non-static inner class may have object instances that are associated with instances of the class's outer class. A static inner class does not have any object instances.
--------------------------------------------------------------------------------
What is an object's lock and which object's have locks? An object's lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object's lock. All objects and classes have locks. A class's lock is acquired on the class's Class object.
--------------------------------------------------------------------------------
When can an object reference be cast to an interface reference? An object reference be cast to an interface reference when the object implements the referenced interface.
--------------------------------------------------------------------------------
What is the difference between a Window and a Frame? The Frame class extends Window to define a main application window that can have a menu bar.
--------------------------------------------------------------------------------
What do heavy weight components mean? Heavy weight components like Abstract Window Toolkit (AWT), depend on the local windowing toolkit. For example, java.awt.Button is a heavy weight component, when it is running on the Java platform for Unix platform, it maps to a real Motif button. In this relationship, the Motif button is called the peer to the java.awt.Button. If you create two Buttons, two peers and hence two Motif Buttons are also created. The Java platform communicates with the Motif Buttons using the Java Native Interface. For each and every component added to the application, there is an additional overhead tied to the local windowing system, which is why these components are called heavy weight.
--------------------------------------------------------------------------------
Which package has light weight components? javax.Swing package. All components in Swing, except JApplet, JDialog, JFrame and JWindow are lightweight components.
--------------------------------------------------------------------------------
What are peerless components? The peerless components are called light weight components.
--------------------------------------------------------------------------------
What is the difference between the Font and FontMetrics classes? The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of a Font object.
--------------------------------------------------------------------------------
What happens when a thread cannot acquire a lock on an object? If a thread attempts to execute a synchronized method or synchronized statement and is unable to acquire an object's lock, it enters the waiting state until the lock becomes available.
--------------------------------------------------------------------------------
What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy? The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.
--------------------------------------------------------------------------------
What classes of exceptions may be caught by a catch clause? A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and Exception types.
--------------------------------------------------------------------------------
What is the difference between throw and throws keywords? The throw keyword denotes a statement that causes an exception to be initiated. It takes the Exception object to be thrown as argument. The exception will be caught by an immediately encompassing try-catch construction or propagated further up the calling hierarchy.
The throws keyword is a modifier of a method that designates that exceptions may come out of the mehtod, either by virtue of the method throwing the exception itself or because it fails to catch such exceptions that a method it calls may throw.
--------------------------------------------------------------------------------
If a class is declared without any access modifiers, where may the class be accessed? A class that is declared without any access modifiers is said to have package or friendly access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.
--------------------------------------------------------------------------------
What is the Map interface? The Map interface replaces the JDK 1.1 Dictionary class and is used associate keys with values.
--------------------------------------------------------------------------------
Does a class inherit the constructors of its superclass? A class does not inherit constructors from any of its superclasses.
--------------------------------------------------------------------------------
Name primitive Java types. The primitive types are byte, char, short, int, long, float, double, and boolean.
--------------------------------------------------------------------------------
Which class should you use to obtain design information about an object? The Class class is used to obtain information about an object's design.
--------------------------------------------------------------------------------
How can a GUI component handle its own events? A component can handle its own events by implementing the required event-listener interface and adding itself as its own event listener.
--------------------------------------------------------------------------------
How are the elements of a GridBagLayout organized? The elements of a GridBagLayout are organized according to a grid. However, the elements are of different sizes and may occupy more than one row or column of the grid. In addition, the rows and columns may have different sizes.
--------------------------------------------------------------------------------
What advantage do Java's layout managers provide over traditional windowing systems? Java uses layout managers to lay out components in a consistent manner across all windowing platforms. Since Java's layout managers aren't tied to absolute sizing and positioning, they are able to accommodate platform-specific differences among windowing systems.
--------------------------------------------------------------------------------
What are the problems faced by Java programmers who don't use layout managers? Without layout managers, Java programmers are faced with determining how their GUI will be displayed across multiple windowing systems and finding a common sizing and positioning that will work within the constraints imposed by each windowing system.
--------------------------------------------------------------------------------
What is the difference between static and non-static variables? A static variable is associated with the class as a whole rather than with specific instances of a class. Non-static variables take on unique values with each object instance.
--------------------------------------------------------------------------------
What is the difference between the paint() and repaint() methods? The paint() method supports painting via a Graphics object. The repaint() method is used to cause paint() to be invoked by the AWT painting thread.
--------------------------------------------------------------------------------
What is the purpose of the File class? The File class is used to create objects that provide access to the files and directories of a local file system.
--------------------------------------------------------------------------------
What restrictions are placed on method overloading? Two methods may not have the same name and argument list but different return types.
--------------------------------------------------------------------------------
What restrictions are placed on method overriding? Overridden methods must have the same name, argument list, and return type. The overriding method may not limit the access of the method it overrides. The overriding method may not throw any exceptions that may not be thrown by the overridden method.
--------------------------------------------------------------------------------
What is casting? There are two types of casting, casting between primitive numeric types and casting between object references. Casting between numeric types is used to convert larger values, such as double values, to smaller values, such as byte values. Casting between object references is used to refer to an object by a compatible class, interface, or array type reference.
--------------------------------------------------------------------------------
Name Container classes. Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane
--------------------------------------------------------------------------------
What class allows you to read objects directly from a stream? The ObjectInputStream class supports the reading of objects from input streams.
--------------------------------------------------------------------------------
How are this() and super() used with constructors? this() is used to invoke a constructor of the same class. super() is used to invoke a superclass constructor.
--------------------------------------------------------------------------------
How is it possible for two String objects with identical values not to be equal under the == operator? The == operator compares two objects to determine if they are the same object in memory. It is possible for two String objects to have the same value, but located indifferent areas of memory.
--------------------------------------------------------------------------------
What an I/O filter? An I/O filter is an object that reads from one stream and writes to another, usually altering the data in some way as it is passed from one stream to another.
--------------------------------------------------------------------------------
What is the Set interface? The Set interface provides methods for accessing the elements of a finite mathematical set. Sets do not allow duplicate elements.
--------------------------------------------------------------------------------
What is the List interface? The List interface provides support for ordered collections of objects.
--------------------------------------------------------------------------------
What is the purpose of the enableEvents() method? The enableEvents() method is used to enable an event for a particular object. Normally, an event is enabled when a listener is added to an object for a particular event. The enableEvents() method is used by objects that handle events by overriding their event-dispatch methods.
--------------------------------------------------------------------------------
What is the difference between the File and RandomAccessFile classes? The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file.
--------------------------------------------------------------------------------
What interface must an object implement before it can be written to a stream as an object? An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object.
--------------------------------------------------------------------------------
What is the ResourceBundle class? The ResourceBundle class is used to store locale-specific resources that can be loaded by a program to tailor the program's appearance to the particular locale in which it is being run.
--------------------------------------------------------------------------------
What is the difference between a Scrollbar and a ScrollPane? A Scrollbar is a Component, but not a Container. A ScrollPane is a Container. A ScrollPane handles its own events and performs its own scrolling.
--------------------------------------------------------------------------------
What is a Java package and how is it used? A Java package is a naming context for classes and interfaces. A package is used to create a separate name space for groups of classes and interfaces. Packages are also used to organize related classes and interfaces into a single API unit and to control accessibility to these classes and interfaces.
--------------------------------------------------------------------------------
What are the Object and Class classes used for? The Object class is the highest-level class in the Java class hierarchy. The Class class is used to represent the classes and interfac

Wednesday, December 08, 2004

java group postings

-------------------------------------------
What is the difference betweeen Factory pattern and Abstract factory pattern.
Abstract Factory is a collection of Factory Methods. The purpose of the Abstract Factory is to provide an interface for creatingfamilies of related objects without specifying concrete classes.
The Factory Method defines an interface for creating objects, but letssubclasses decide which classes to instantiate.



------------------------------------------------

Can you tell me how can session be handled after usingsession.redirect? Since one looses every thing fromthe initial request.

While using redirect() you will loose the info in the previous request Object...however you can save the info needed info in the HttpSession...or can use the forward() method of the RequestDispatcher...

----------------------------------------------
Hello World
XSL File
http://www.w3.org/1999/XSL/Transform">



Try this, the changes bolded
http://www.w3.org/1999/XSL/Transform">


--------------------------------------------

What is Raw Byte Handling.
----------------------------------------------
Dear Friends,Can any one give the link of any ebook for Core Java DesignPatterens.I want the explanation in java.I looking for a book like patternsin java.

Thinking in patterns <http://www.mindview.net/Books/TIPatterns/> and
The Design patterns Java Companion By James Cooper <http://www.patterndepot.com/put/8/JavaPatterns.htm>
are good source for Design patterns . I guess it will be helpful.
Hi,
Download Java Design Patterns By Jamers Cooper from the following link.
http://www.patterndepot.com/put/8/DesignJavaPDF.ZIP
Regards,
hiTo understand the basic concept of Design Pattern, the following link be usefulwww.javacamp.org/designpattern/about.html ----------------------------------------------
Can we compile java classes in a package recursively.using the javac command...i mean to say if we have classes in the package say 'com' and also in the package 'com.test' then can we compile classes in both the packages using a single javac command option
Yes. There is an open source tool called "ANT (Another Neat Tool) by which can compile java files across the packages.

Ant is a very widely used tool for building Java-based apps. See the link below for details.
http://ant.apache.org/index2.html
I am not sure how its done in ANT but using Makefile in unix i had to use the javac command only and there i had to 'find' each file and compile...may be my approach was wrong...can u throw some light on it and give some more info please

ant uses an xml file called build.xml
you need to write this file (there are tools that generate a skeleton for this e.g. Forte for Java / SUN ONE Studio)the commands that ant will execute are defined as part of this xml file e.g javac, jar, etc
One of the ANT tags in the build.xml file is javac and one of it attrs is src, you can give a path to src and then run ant on that xml file, that will compile the source codes in that path only.






have a look at http://www.iseran.com/Java/ant/tutorial/ant_tutorial.html <http://www.iseran.com/Java/ant/tutorial/ant_tutorial.html> for more info http://ant.apache.org/ <http://ant.apache.org/> is also very good

There is two solutions.
1) If you want to use javac then you can use -doption.like javac -d dest-path source-path/*.javabut in this case you need to find source-path everytime in loop.2) Use ANT it works for unix you need to just create abuild xml file to do your stuff.
------------------------------------------------------
Can anyone tell me how to use session in a jsp page.why it gives HTTP 500 Internal Server error while i use session.getAttribute . I am using JavaWebServer2.0 .

my understanding is, while jsp pages are translated to servlets you can simple think that you are writing a servlet.the following should be fine in your jsp page.
<%!
private MyClass myclass;
public void jspInit() {myclass = (MyClass)getServletContext().getAttribute("myattribute");if (myclass == null)System.out.println("Couldn't get attribute.");}public void jspDestroy() {myclass = null;}%> It is an server error.may you "reset" it?
if it persist, you can check the configuration and the system

----------------------------------------------
Hi,I hope you are aware that there are 3 methods of Security that you can implement viz, 1.Basic, 2.Form, 3. Certificate.
In declarative form of security, we have to provide a security realm( like windows or some database), In the case of an database we have to specify in the server specific xml file for example in Tomcat there is an file called Server.xml where in you need to provide the Database name, table name, column name, driver name, etc. and in the web.xml you need to mention " FORM ". This will automatically authenticate users and also we need to protect resources by specifying the type of request or urls that can be accessed.

Moderators, Good books are available at http://books.wontstop.com/ , please include this in the links section.

ORACLE JDeveloper is the best for J2EE solutios.. I have used both and ifoucnd it more powerful tool...
if i write this in my jsp
"/>
I get the value of the expression in scriptlets, but this tag is notconverted in to
but if i write It is wellconverted to why it is so ??if taglibs does not supoort dynamic value, how to handle these.
Also I tried one more thing
" action="selectLib"type="com.filenet.SampleApp.LibSelectionForm">
This is printed n html as it is, whreas I expect the value of i to appearinstaed of the expression.
Any clue on this, please reply.

u need to check if in the taglib the the element is set to truefor the tag.
For the second problem do the following
<% String s = "form"+i ;%>" action="selectLib"type="com.filenet.SampleApp.LibSelectionForm">
This should work as I hv tried it before.
is set to true for tag called hidden in tag library.
I have this tag in my code.
I am able to have the value coming in the tag. But the tag is not convertedto the html hidden tag. But if i remove the dynamic expression from the tagdefinition in my jsp. The tag is rendered as html hidden tag.
Now I am not using taglib's hidden tag. 'm using html's hidden tag. now itsworking fine.
but i cud not find the solution for my problem.
Try the following:
<%String prop = properties.getProperty( "Host[" +i + "]" ) ;%>"/>
It should work. Plz lemme know if does.

I think the problem is in apostrophes. (") value="some expression". Tag libmay be searching the closing apostrophe and it can cause problems
-------------------------------------------
What is the difference betweeen Factory pattern and Abstract factory pattern.
Abstract Factory is a collection of Factory Methods. The purpose of the Abstract Factory is to provide an interface for creatingfamilies of related objects without specifying concrete classes.
The Factory Method defines an interface for creating objects, but letssubclasses decide which classes to instantiate.



------------------------------------------------

Can you tell me how can session be handled after usingsession.redirect? Since one looses every thing fromthe initial request.

While using redirect() you will loose the info in the previous request Object...however you can save the info needed info in the HttpSession...or can use the forward() method of the RequestDispatcher...

----------------------------------------------
Hello World
XSL File
http://www.w3.org/1999/XSL/Transform">



Try this, the changes bolded
http://www.w3.org/1999/XSL/Transform">


--------------------------------------------

What is Raw Byte Handling.
----------------------------------------------
Dear Friends,Can any one give the link of any ebook for Core Java DesignPatterens.I want the explanation in java.I looking for a book like patternsin java.

Thinking in patterns <http://www.mindview.net/Books/TIPatterns/> and
The Design patterns Java Companion By James Cooper <http://www.patterndepot.com/put/8/JavaPatterns.htm>
are good source for Design patterns . I guess it will be helpful.
Hi,
Download Java Design Patterns By Jamers Cooper from the following link.
http://www.patterndepot.com/put/8/DesignJavaPDF.ZIP
Regards,
hiTo understand the basic concept of Design Pattern, the following link be usefulwww.javacamp.org/designpattern/about.html ----------------------------------------------
Can we compile java classes in a package recursively.using the javac command...i mean to say if we have classes in the package say 'com' and also in the package 'com.test' then can we compile classes in both the packages using a single javac command option
Yes. There is an open source tool called "ANT (Another Neat Tool) by which can compile java files across the packages.

Ant is a very widely used tool for building Java-based apps. See the link below for details.
http://ant.apache.org/index2.html
I am not sure how its done in ANT but using Makefile in unix i had to use the javac command only and there i had to 'find' each file and compile...may be my approach was wrong...can u throw some light on it and give some more info please

ant uses an xml file called build.xml
you need to write this file (there are tools that generate a skeleton for this e.g. Forte for Java / SUN ONE Studio)the commands that ant will execute are defined as part of this xml file e.g javac, jar, etc
One of the ANT tags in the build.xml file is javac and one of it attrs is src, you can give a path to src and then run ant on that xml file, that will compile the source codes in that path only.






have a look at http://www.iseran.com/Java/ant/tutorial/ant_tutorial.html <http://www.iseran.com/Java/ant/tutorial/ant_tutorial.html> for more info http://ant.apache.org/ <http://ant.apache.org/> is also very good

There is two solutions.
1) If you want to use javac then you can use -doption.like javac -d dest-path source-path/*.javabut in this case you need to find source-path everytime in loop.2) Use ANT it works for unix you need to just create abuild xml file to do your stuff.
------------------------------------------------------
Can anyone tell me how to use session in a jsp page.why it gives HTTP 500 Internal Server error while i use session.getAttribute . I am using JavaWebServer2.0 .

my understanding is, while jsp pages are translated to servlets you can simple think that you are writing a servlet.the following should be fine in your jsp page.
<%! private MyClass myclass; public void jspInit() {myclass = (MyClass)getServletContext().getAttribute("myattribute");if (myclass == null)System.out.println("Couldn't get attribute.");}public void jspDestroy() {myclass = null;}%>It is an server error.may you "reset" it?
if it persist, you can check the configuration and the system

----------------------------------------------
Hi,I hope you are aware that there are 3 methods of Security that you can implement viz, 1.Basic, 2.Form, 3. Certificate.
In declarative form of security, we have to provide a security realm( like windows or some database), In the case of an database we have to specify in the server specific xml file for example in Tomcat there is an file called Server.xml where in you need to provide the Database name, table name, column name, driver name, etc. and in the web.xml you need to mention " FORM ". This will automatically authenticate users and also we need to protect resources by specifying the type of request or urls that can be accessed.
----------------------------------------------

Moderators, Good books are available at http://books.wontstop.com/ , please include this in the links section.

Hello Jailani and All,> > Preparation time for SCEA-Part really depends upon> one's current level of knowledge in various concepts> covered in objectives.> > I followed following steps and scored 95 % in my> examination last week and I have 15 years of IT> experience.> > STAGE-I: > =======> > Duration: 2 hours> > a. Read objectives of SCEA-PartI and identify> the> areas you have to cover. > > STAGE-II :> =========> Duration: 6 weeks (3 hours per Day in Weekdays and 6> hours per day in week ends)> > a. Primary goal of this stage is KNOWLEDGE> GAIN.> b. Secondary goal of this stage is scoring Mark.> c. Don't go through any question & answers and> mock exams at this stage, because if we limit our> knowledge to only Q & As, our level of understanding> will also be limited to Q & As level.> d. Go through the required books and study> materials available in scea_prep,scea_j2ee and> j2eeworld. Also you may need to concentrate on few> specific areas in each book (For example, while> reading EJB 1.1 spec, you have to concentrate on EJB> LIFE CYCLE, COMPONENT AND CONTAINER CONTRACTS..ETC)> > e. While reading materials, you may prepare your> handwritten notes or hints about all concepts. This> helps you very much when you want to have a glance> over concepts before your examination.> > > STEP:III > ========> > Duration: 2 Weeks.(3 hours per Day in Weekdays and 6> hours per day in week ends)> > > In this stage make a small change that your primary> goal is scoring mark.> > a) Go through Mock exams,Wizlab practice> questions again and again.Make sure that you score> 100> %.> b) Identify your areas of weakness.Read and> understand more about that area.> b). Please make sure that the answers are not> memorized.> c) Go for exam.> > > If you guys are interested, I can give you more> clues> about how to identfy exact areas to concentrate and> how to score higher percentage?> > All the best> KRISHNADOSS PARTHASARATHY

Tuesday, December 07, 2004

java group2

I am looking for the file rowset.jar to implement a CachedRowSet. But I am not able to find the rowset.jar file anywhere on the net. There are couple of articles which have referenced the following urls for download:
http://jcp.org/en/jsr/detail?id=114http://developer.java.sun.com/developer/earlyAccess/crs/
But i couldn't see the file. I would really appreciate if somebody can send me the file or give me the link.
There r many comparisons available on net. See the one by PCMag. They rates JBuilder as the better one.
http://www.pcmag.com/print_article/0,3048,a=44685,00.asp
Please join J2EE_SCBCD
if you dont have budget problems, i think that Borlandenterprise studio is one of the best products (itincludes jbuilder 9).

java groups ..............

the log generates a Scheme script (using Kawa)



testing and debugging under SSL.Yes, SSL is _supposedly_
transparent to the browser...

simple PC proxy (Http Proxy-Spy)


My favorite IE4.0 bug: if you POST form data in IE4
to an SSL server with a non-Verisign cert, you have to step through a
dialog accepting the new Certificate Authority, after which IE4 gladly
resumes the POST - without the data. Took a little while to figure
out what was going on there.

I know that integrating SSL involves licensing issues.


WebLoad from Radview.
It has a number of features but
at the core it allows you to visit a website, do "stuff" across a number of
pages and then save that as a use case. You can then build a scenario
composed of multiple use cases. (The use case is a script that can be
replayed later with a number of options incl. many threads). Very good from
testing perspective and can be mapped to Use Cases proper. Take a look at
the tool and other commercial or semi-coffercial offerings to get a better
idea of a feature set.


(like all Tapsell-Ferrier work) GPLed

oxymoron


API 2.2 strongly encourages webapp packaging


-----------------------------------------------------------------------------------

http://www.w3schools.com/soap/default.asp


i use orian as servlet contener and apache for php



case study

hi i work in a java projetc that integrat with many
> > application
> > this application is clusterd in 2 machiens and
> > integrate with php application
> > run in apache http server
> >
> > what i need to know is
> > how to syncronize user account between all these
> > apllication and how to enable
> > sso Single sign on
> > 2 ) when i press log out button on the main
> > application how can i destroy the
> > session in atheres applicatino i mean php
> > applications and java apllications in
> > anathere web context



sever clustring/load balancing and
> session replication.

--------------------------------------------

Invoke the ejb methods from the respective action classes.

If its a production
application then have a simple java class (Business Delegates) to abstract
out
the web layer and have the EJB calls in the Business Delegates


I am not sure whether STruts supports EJB coz
i think Struts is a typical web framework with no
support for Enterprise Applications.
Please neone having concrete idea come up n suggest
the same to the group.
If it supports Enterprise Applications then of course
we need to use Business Delegate Design Pattern in
order to abstract the EJB Layer from the Web Layer.

Struts like u said is a web framework but at the same time it need not
support Enterprise Applications or anything else. This framework is just an
abstraction and the containers have to support struts and not vice versa.
Hence, struts can be used in any kind of deployment instead of the normal jsp
layer.
I think, the business delegate pattern is a good option for Rajat's
problem. Another option could be using a proxy class for all backend
interactions, thus clearly demarking the weblayer from the rest. I do not
know, in which design pattern this can be classified.



I still am not sure whether you
can call methods on the Home Interface of Business
Delegate Class from the Action Class?
Really If its possible then how can it be put into
implementation?

You can call any method on any delegate or in fact the bean itself from
ur action class. For all practical purposes in order to access an EJB, an
action class is but another class. U can make JNDI calls from ur action class
itself. I hope I hv answered ur question, if not plz revert back.

Hi All,
EJBException subclasses RuntimeException , so
when an EJBContainer throws an EJBException , it wraps
it in a RemoteException before returning it to the
client Application which is invoking the EJB.
For Ex - · If the ejbLoad and ejbStore methods cannot
locate an entity in the underlying database, they
should throw the javax.ejb.NoSuchEntityException. This
exception is a subclass of EJBException. Because
EJBException is a subclass of RuntimeException, you do
not have to include it in the throws clause. When
NoSuchEntityException is thrown, the EJB container
wraps it in a RemoteException before returning it to
the client.
So at client side Application , how are we suppose to
know that NoSuchEntityException is thrown at the EJB
level coz every System level exception is wrapped in a
RemoteException before returning it to the client.


You can call getCause() method on the RemoteException object at client side.
It will return you the wrapped
remote exception.


System Level Exceptions can't be handled by
bean's client program so then how does it interpret as
to what is wrapped in the remote exception.

Could u just explain me with some code...
Is it possible to catch the System Level exceptions
like RemoteException in our EJBClient Program.

For ex can we have like this in our EJBclient Program
try
{
//invoking methods on EJB via Remote Interface.
}catch(RemoteException e)
{

}


TRY THIS IN UR CLIENT CODE...


Try {

........

......

remoteObject.remoteMethod( );

......

} catch( RemoteException re ) {

Throwable th = re.getCause( ); // same as Throwable
th = re.detail;

System.out.println( th.getCause( ) ); // most likely it will
print null, untill the nested exception in "th" does not have a nested
exception in it also.

System.out.println( th.getMessage( ) );

}


Yes that is what is good design. Have EJB calls in a seperate class( That is
what I called Business Delegates) and call those from
Action Classes. If there are multiple Business Delegate calls then add a
facade :)


the CLIENT has no need to know the system level exception.
Only app level exceptions he need to know bcoz he can do something to
continue or he can roll back.
but reagrds system level exception, there is no need like that ...only
thing he needs to know is thet SOME system exception has happened.
It is the responsibility of the system/container to do the needful



http://www.husted.com/struts/tips/018.html


http://www-106.ibm.com/developerworks/java/library/j-ejbexcept.html
----------------------------------------------------------------------------------

How can I declare global variable in Servlet and JSP which can be accessed by all other Servlets / JSP present in the same container

U can use session variables which are available thru out the session and
are accessable by all jsps/servlets

Use Application object for that.....


or u can use ServletContext, which can be accessed by all servlets/jsp within a container.

This can be done by setting the variable in
ServletContext.Use getAttribute() and setAttribute
methods of ServletContext.


Using application variable one can access across the SERVLET/JSP page.

In Servlet
ServletContext context = getServletConfig().getServletContext();
context.setAttribute(string_name, object) ; // for setting the variable with value
context.getAttribute(string_name) ; // for getting the value

In JSP
application.setAttribute(string_name, object) ;
application.getAttribute(string_name) ;


Well, it depends on what kind of information he is intending to share.

If this information is of application scope, and this application isn't
expected to run in multiple servers, the ServletContext fits perfect.

If the information is specific to a sessioned user, so there's no doubt he
must use sessions.

And finally, if this information has application scope, and the application
is intended to run in a multiple server configuration (distributable
application), so it's better to persist this information in an outside
environment such as a database server.

hi, put ur attributes in ServletContext object, so that they will be
visible in every file within the context.





-------------------------------------------------------------------------------------

<%
try {
Properties properties = new Properties( );
properties.load( new FileInputStream( new File( "library.properties" )
) );
out.println( properties );
} catch( java.io.FileNotFoundException fnf ) { out.println( fnf ); }

%>


The code written above is a piece of code from my jsp file. I want to load
library.properties file into the properties object.
But I get java.io.FileNotFoundException.

I am deploying my application on BEA Weblogic 7.0 using jdk1.3.1_06. I am
keeping this file in the same directory, where my jsp files are lying.
But I am getting this exception. (I have also tried by keeping the file in
the directory where weblogic is keeping the complied servlet. but it is
still not working. Although I don't any such kind of solution. I have also
tried by all relative paths. I don't want to hardcode the full path of the
file.) I have tried to load a properties file in a simple Test class, there
it works.

import java.io.*;

public class Test {

public static void main( String ar[] ){
File file = new File( "A.txt" );
System.out.println( file );
}
}


It works in the above code. here A.txt at the same place, where Test class
is.

please give me some solution.
http:\www.hcltechnologies.com


I am not sure whether relative paths work
while reading the file. It needs the physical path
hardcoded into it.So what u can do is instead of
hardcoding the physical path in the jsp file.Put the
hardcoded value in some parameter in the config file
and read the value from it.But then the config file
needs to be read everytime u invoke a jsp again.


I cannot figure out the cause for the error u r getting but the foll code I
hv used and it works, that is if u want to use it as a resource bundle.

ResourceBundle.getBundle("library", new Locale("en","US"));

Note: I hv not mentioned the extension that is ".properties" is omitted from
the file name.

Tell me if it works.

The system cannot resolve the classpath for the property file. So it failed
to load.

Try the following piece of code, it will solve the problem.

String PROP_FILE = "library.properties";
try {
InputStream propFile =
this.getClass().getClassLoader().getResourceAsStream(PROP_FILE);
Properties properties = new Properties();
properties.load(propFile);
propFile.close();
}
catch(IOException ioe){
}

Thanks a lot. It worked using ur method.
But to use ur method, i had to keep library.properties in classpath, And it
worked.

Yes Praveen, u need to keep the library.properties file in ur classpath.


--------------------------------------------------------------------------

Try by this way.
Just create a simple new file in you jsp namely,
"x.txt", and check where the file is going to be
creating in your web logic. By this you can find out
where servlet context is going to create file for your
web application. And then place your required file in
that location.
--------------------------------------------------------------------------
hi ,
i am using tomcat 3.2.1 for deploying servlets and jsp. i am using it from past 2 years. recently i am getting the following error in tomcat. its printing this error continuously in tomcat console.

The error is following

java.io.IOException: The filename, directory name, or volume label syntax is inc
orrect
at java.io.Win32FileSystem.canonicalize(Native Method)
at java.io.File.getCanonicalPath(File.java:437)
at org.apache.tomcat.util.FileUtil.safePath(FileUtil.java:184)
at org.apache.tomcat.core.Context.getRealPath(Context.java:797)
at org.apache.tomcat.request.StaticInterceptor.requestMap(StaticIntercep
tor.java:196)
at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.j
ava:835)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.
java:786)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758
)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
n(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java
:501)
at java.lang.Thread.run(Thread.java:484)
2003-09-04 12:01:42 - Ctx( ): 404 R( + http:/www.commonname.com/en/agent/hello
.asp + null) null


please help me in solving this. rakesh


I've never seen this error before, but i suppose it's related to path names.

It seems the problem is a getRealPath call on a request Map, so maybe this
error lies on your web.xml file.

Maybe you are passing an inverted slash "\" in a place where tomcat is
expecting a normal slash "/" or vice-versa.


----------------------------------------------------------------------------
Java is not 100% Object Oriented because it still use primitive
datatypes like int,long,float etc.,The designers of java can made this as
object,but it will increase the memory and reduce the performance.so they
are retained as primitive datatypes.They have given a provision to make
them objects,if necessary throu' Wrapper Classes.


http://www.javaworld.com/javaworld/javatips/jw-javatip30.html
http://www.faqs.org/docs/think_java/TIJ309.htm


Can u do operator overloading in java ?no

Operator overloading is a special option. It is not required to support
polymorphism.

Safe programming is an important issue in Java so Op. Ov. is not allowed.
But it doesn't mean polymorhism is not supported by Java.

I think method overriding is enough to support the polymorhism

Internally java uses operator overloading and pointers but it does not allow a programmer to do the same

http://java.sun.com/people/jag/FP.html#overloading

An interesting thread on this in google groups:

http://groups.google.com/groups?q=g:thl543828996d &dq=&hl=en&lr=&ie=UTF-8&edition=us&selm=st1s4usuj6mfcdhjq4n8n8app5h4td40gm%404ax.com

There are 136 posts there! Pretty messy URL. You might want to search for " James Gosling wants operator overloading in Java"
in groups.google.com and read the first currently first entry there..
-----------------------------------------------------------------------------


use eMule