MY mENU


Saturday, 16 March 2013

Enumeration in Java


Java.util.Enumeration:
Enumeration is one of the predefined Interface present in Java.util.* package. An object of Enumeration Interface object is used for extracting or retrieving data from any legacy collection framework variable only in forward direction. When we create on enumeration, which is by default pointing just before the first element at any legacy collection frameworks.
The functionality of Enumeration (Synchronized) is more or less Iterator Interface (Non-Synchronized)
Methods:
 Public boolean hasMoreElements(): it returns true provided enumeration Interface object is having more number of elements  in legacy collection framework variable otherwise it returns false.
Public object nextElement ():  is used for uptaining next element of any legacy collection framework variable provided Public boolean hasMoreElements() must returns true.
Syntax:
 While(en.hasMoreElements()){
Object obj=en.nextElement();
System.out.println(obj);
}

Friday, 15 March 2013

One of Logical Interview Question I faced:

A good Employee is defined who has all the following properties:
1. Employee must be married.
2. Employee has at least 2 children 
3. His Middle Name Start with “K” and Ends With “E”.
4. His Last Name has at least 4 characters, and starts with “A”
5. In His childrens have at least one name “Raja”.
Write a method:
boolean isGoodEmployee( boolean isMarried, int noOfChild , String middleName , String lastName , String[] childNames){

Answer:
import java.io.*;
class Employ
{
boolean isMarried;
int noOfChild;
String middleName;
String lastName;
String[] childNames;

boolean isGoodEmployee( boolean isMarried, int noOfChild , String middleName , String lastName , String[] childNames){
this.isMarried=isMarried;
this.noOfChild=noOfChild;
this.middleName=middleName;
this.lastName=lastName;
this.childNames=childNames;

int mlength=middleName.length();
int ml=mlength-1;
int lnLength=lastName.length();
int count=0,name=0;

int childln=childNames.length;

if(isMarried==true)
{
//return true;
}else {
System.out.println("He is not Married");
}

if (noOfChild<=2){

//return true;
}else {
System.out.println("not about children");
}

//System.out.println(ml);
//System.out.println(middleName.charAt(ml));
//System.out.println(middleName.charAt(0));

if(middleName.charAt(0)=='k') {
if(middleName.charAt(ml)!='e'){
// return true;
}else{
System.out.println("Name not in COrrect formate");
}
}

if(lnLength>4){
for(int i=0;iif(lastName.charAt(i)=='a')
count=count+1;
}
//System.out.println(count);
if(count>=2){
}else{
System.out.println("Last Name not in Correct form");
}

}

//System.out.println(childNames[0]);
//System.out.println(childln);

for(int i=0;i{

if(childNames[i].equals("Raja")){
name=name+1;
}
if(name>=1){

//return true;
}else{
System.out.println("NO One Children is RAJA");
}
}

System.out.println(" Good Employee");
return true;

}

public static void main(String[] args)
{
String mName="kiranew";
String lName="Maadhu";
boolean married=true;
String[] childN={"Raja","Latha"};
int noChild=2;
Employ em=new Employ();
em.isGoodEmployee(married,noChild,mName,lName,childN);

}
}

Thursday, 14 March 2013

Add “Recycle Bin” to My Computer in Windows 7 and Vista:

Would you like to add the “Recycle Bin” icon to My Computer so that you need not go back to the desktop to access it when required? Well, here is how you can do that:

Open the Registry Editor and navigate to the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace
Right-click on “NameSpace” and select New -> Key. Name the key with the following name:
{645FF040-5081-101B-9F08-00AA002F954E}
Now, open “My Computer” and hit F5 to refresh the screen. This should show up the “Recycle Bin” icon.