Krishnan Loganathan

Greenhorn
+ Follow
since Apr 24, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Krishnan Loganathan

Hi,

If you don't want to access the variable k in the sub class means, declare the variable as private (as of now, it is default). Also, if you don't want to access the method means, mark the method as private. If you make those changes means, it will throw compile time error, as you expected.

Regards,
Loga
10 years ago
Hi Mohan,

Are you storing the data inside an Object and then add that object in the Collection or adding the data in comma seperated format as a String ?. Please clarify me.

Regards,
Loga
10 years ago
Hi Varma,

When you invoke a overloaded method, the compiler will try to invoke the method, from which we can invoke the other overloaded method. (ie., from that method, it can invoke the other method with the same name, in this case, from the method public void myTest(String s), we can invoke the other method public void myTest(Object o))

Due to this, it is invoking public void myTest(String s). If you declare one more method as follows means,

public void myTest(StringBuffer strBuffer) {
}

compiler will throw error, because compiler will get confused, and it doesn't know to invoke which method.


Regards,
Loga
11 years ago
Hi,

please take a close look into the program especially,

if(j==3);
continue inner;
break outer;

see, the if statement has been terminated with ;. so there is no true block or false block for the if. whether j is equal to 3 or not equal to 3, it will execute the next command
contine inner;
once you issued the continue statement, then the control transfers to the start of that loop. So there is no way to execute
break outer;
due to this only, it is throwing compile time error.

Cheers,
Loga
Hi,

Congrats !!!

could you please send me the notes to loga.rainbow@gmail.com

thanks in advance !!!

Cheers,
Loga
Hi Hemand,

if you are staying in banglore, you can directly access the sun microsystems which is located in residency road.


Regards,
Loga
Hi senthilnathan,

when you issue the command
i = i++;

first it will assign the old value of 'i' (ie., 11) to the i and then it will add 1 to the old value.

so, when you print the i, it will print 11 only.

you just modify the code slightly as follows and test

int j = i++;
System.out.println("the value of i ==> " + i);

now it will print 12. because you are assiging the old value of i to the seprate variable 'j'.

Thanks & Regards,
Loga
Hi Velan,

The output will be 'B' - false

Regards,
Loga
Hi Velan,

The result will be 'C'.

When ever, we are trying to catch multiple exceptions, the order should be in the way that it should from sub-class to the super class. So, in your case, you have to start catch the ArithmeticException in the first catch block and the generic Exception in the second catch block.

Regards,
Loga
Hi Guys,

will u pls refer me some books to prepare SCJP 1.5 ?


Regards,
Loga
12 years ago
Hi,
I cannt able to get your question. Whether u want to store all the details about the employee ( id,name, age, salary etc...) or any one in the hashtable ?

If u want to store all the details about the employee means, please create a class Employee with id, name, age salary as the attributes and store the employee object in the hash table as follows


public class Employee {
private String id = null;
private String name = null;
private double salary = null;

public Employee(String id, String name, double salary) {
this.id = id;
this.name = name;
this.salary = salary;
}

public void setId(String id) {
this.id = id;
}

public String getId() {
return id;
}

public void setName(String name) {
this.name = name;
}

public String getName() {
return name;
}

public void setSalary(double salary) {
this.salary = salary;
}

public double getSalary() {
return salary;
}

}


import java.util.*;

public class HashTableDemo {

public static void main(String[] args) {
Hashtable empDemo = new HashTable();
Employee emp1 = new Employee("1","one",1.0);
Employee emp2 = new Employee("2","two", 2.0);

empDemo.put(emp1.getId(), emp1);
empDemo.put(emp2.getId(), emp2);

Iterator keyIterator = empDemo.keySet().iterator();
while(keyIterator.hasNext()) {
String key = (String) keyIterator.next();
Employee emp = (Employee) empDemo.get(key);
System.out.println(" Id == > " + emp.getId() + " Name ==> " + emp.getName() + " Salary ==> " + emp.getSalary());
}
}
}


The Output :-

Id ==> 1 Name ==> One Salary ==> 1.0
Id ==> 2 Name ==> Two Salary ==> 2.0


Regards,
Loga
12 years ago
Hi Ganesh,

I cannt able to get your question. Will u pls explain it little bit eloborately ?

Regards,
Loga
12 years ago
Hi,
An interface which contains no methods or member variables will be called as Marker Interface. For eg:- Remote, Serializable or marker interfaces. Why because, the compiler will check whether that class is an instance of that interface ( for eg:- serializable) and if it is true means, it will serialize that object.

Regards,
Loga
12 years ago
Hi,
I cannt able to get it. What value u want to be in int ? . either hours/minutes/seconds ? In java.sql.Time we are having methods such as getHours(), getMinutes(), getTime(). please look into it.

Cheers,
Loga
13 years ago
Hi,
In java, the primitive type variables are call-by-value and objects are call-by-reference. But for String, still its a call-by-reference, u cannt modify the value since it is immutable.


Cheers,
Loga
13 years ago