tag:blogger.com,1999:blog-18857267747790350812024-03-08T16:50:48.976-08:00JAVA PAVThis blog is created to discuss some of the interesting questions of J2EE world.Tonnethttp://www.blogger.com/profile/17654714948426813134noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-1885726774779035081.post-90823967113626611442009-10-08T03:18:00.000-07:002009-10-08T03:20:51.659-07:00Sharepoint - when you get the message that file is locked by yourself.I was facing an issue while editing a heavy document. The xls document was getting crashed very frequently and then I was not able to check in my changes. In this scenario, the document didn’t open as expected and I received the following message in a File in Use dialog box:FileName is locked for editing by 'another user'.I searched on Google and found that it’s a common issue. As per the Tonnethttp://www.blogger.com/profile/17654714948426813134noreply@blogger.com1tag:blogger.com,1999:blog-1885726774779035081.post-43679381916910847562009-02-15T22:35:00.000-08:002009-02-15T22:48:08.496-08:00When to use an array of size zero ?Question: Java provides the facility to have an array of size zero. Do we have any scenario when this zero size array can be used ?Scenario1: Suppose, I have a method returning an array. So the method can return an array with values or null. If the code invoking method is not checking for null, can get an exception.So sometimes it is better to return an array with size zero to avoid Tonnethttp://www.blogger.com/profile/17654714948426813134noreply@blogger.com2tag:blogger.com,1999:blog-1885726774779035081.post-42812223812419481642009-01-13T03:56:00.000-08:002009-01-13T04:05:57.424-08:00SSL - How to decide if a web page is secure?Whenever we talk about internet security, we use the word SSL. I found a very good description of SSL in a book but wanted to have something online. So while searching, I found a very nice and interesting article related to internet security and SSL. So just click the link below and feel more secure :)http://info.ssl.com/article.aspx?id=10068I will edit the same post whenever getting something Tonnethttp://www.blogger.com/profile/17654714948426813134noreply@blogger.com2tag:blogger.com,1999:blog-1885726774779035081.post-81954902683489110792008-12-12T01:33:00.000-08:002009-02-17T22:57:40.089-08:00Two silly questions for abstract classes1) In which case we need : An abstract class with no abstract methods....Case 1: I have seen many projects using the base class declared as Abstract. Example : Base class for DVOs, Action classes, DAOs etc. These class can contain some basic methods and properties which can be used or overridden by the subclasses. Here, the main purpose of the class is to create a structure (inheritance) not Tonnethttp://www.blogger.com/profile/17654714948426813134noreply@blogger.com7tag:blogger.com,1999:blog-1885726774779035081.post-16882585687616169852008-12-10T21:55:00.000-08:002008-12-10T21:57:41.280-08:00Difference between '\n' and '\f' and '\r'carriage return = come to initial point of a line new line= come to second line (next line). form feed= some characters will be inserted at that place at run time.Please put more light on the basic purpose of these characters.Tonnethttp://www.blogger.com/profile/17654714948426813134noreply@blogger.com0tag:blogger.com,1999:blog-1885726774779035081.post-72754841223318008962008-12-09T04:38:00.000-08:002008-12-09T04:41:09.622-08:00How to print the diagonal elements of a square matrix in a single loop?1st Diagonal:for(int i=0;i< arr.length; i++)SOP(arr[i][i]);2nd Diagonal:for(int i=0;i< arr.length; i++)SOP(arr[i][arr.length - (i+1)]);Tonnethttp://www.blogger.com/profile/17654714948426813134noreply@blogger.com0tag:blogger.com,1999:blog-1885726774779035081.post-81365598658157015202008-12-09T03:37:00.000-08:002008-12-09T03:47:18.815-08:00Abstraction VS EncapsulationHere is some interesting info from http://www.codeguru.com/forum/archive/index.php/t-439501.html:Abstraction is "selective ignorance". You choose to ignore the details of implementation be it in context of exposing interfaces/abstract classes in OOP or just plain functions or files or whatever that helps you categorize various components into independent entities that can take up some Tonnethttp://www.blogger.com/profile/17654714948426813134noreply@blogger.com1tag:blogger.com,1999:blog-1885726774779035081.post-70291724782781847922008-12-08T21:55:00.000-08:002008-12-08T21:57:18.940-08:00Why interface variables are public static and finalMy understanding :1) Why public : Any class or interface in any package should be able to use it. Interface is a contract not implementation.2) Why final: As per OO design rules, attributes that are not an immutable constants should better not be publically accessible. (final means immutable)3) why static : Static with final put the variable out of implementation. It will be treated as a constantTonnethttp://www.blogger.com/profile/17654714948426813134noreply@blogger.com2tag:blogger.com,1999:blog-1885726774779035081.post-43964379332215116172008-12-08T21:48:00.000-08:002008-12-08T21:54:33.919-08:00Difference between Statement and Prepared Statement?DBMS processes a query in following steps :1. Parse the SQL query 2. Compile the SQL query 3. Plan(or optimize) the data acquisition path 4. Execute the optimized query / acquire and return dataSimple Statement: Executes all (1 to 4) for every queryPreparedStatement: pre-executes steps 1 to 3Tonnethttp://www.blogger.com/profile/17654714948426813134noreply@blogger.com0tag:blogger.com,1999:blog-1885726774779035081.post-68090104376911026502007-12-24T04:47:00.000-08:002008-12-09T00:09:02.100-08:00Static Members: Invocation Criteria.public class Test {public static void method(){ System.out.println("Called"); }public static void main(String[] args) {Test t4 = null;t4.method(); } }what will be output of this?No NullPointer Exception : Static methods and variables use class reference to get invoked.(not the object even it is initialized) (parsing time search)Tonnethttp://www.blogger.com/profile/17654714948426813134noreply@blogger.com1tag:blogger.com,1999:blog-1885726774779035081.post-34452235325406662292007-12-24T04:45:00.000-08:002008-12-09T00:07:59.672-08:00Immutable Class: how to createMutable Class: State of the object can be changed.Immutable Class: State of the object cannot be changed.Steps to declare a class Immutable1) Declare all the variables final. : State cant be chaaged.2) Declare all the methods final. : To prevent subclasses from changing the class variables.3) Pass the values for all the properties in constructor. : To initialize the variables by constructor.(One Tonnethttp://www.blogger.com/profile/17654714948426813134noreply@blogger.com3