Harish Babu.N

Greenhorn
+ Follow
since Oct 12, 2000
Merit badge: grant badges
For More
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 Harish Babu.N

Use while(S1==true){
}
that will compare the value of S1
Harish
Hi
What's the diffrence between
String s="asdf"
String s=new String("asdf")
Thanks in advance


Hi rajpal
It gave me compiler error but class file was created and i was able to run the program .Can u explain why is this?
Regards
Harish


Originally posted by Rajpal Kandhari:
Helo Krishna ,

can anyone explain why we cannot write a class as protected?
Who say that we can not write a class as protected. "Java is a funny Language as English."
Have you ever worked with a source code that fails to compile but when you try to run it works just fine. Well this
thing just happen in Java. Check the following code.
protected class Test {
public void SomeMethod (){
System.out.println("Checking if it is working with protected");
}
public static void main (String args[]){
Test obj = new Test();
obj.SomeMethod();
}
}
when you try to compile it will give you compile error saying somthing like class or interface expected.
But on the other hand when you will check you'r directory where you have stored the Test.java file you will see
Test.class file. And now try to run this Test file. It will give you desired output. And this thing will
work with private, static and any combination of access modifiers.
But as the API says that top level class can only be either public or friendly ("default"). And this is the bottom line
Regards,
Raj.--.


hi
Sun certification is difficult,but not an impossible.If u keep solving this forum questions and reading some basics u can easily achieve.Go through some of the sites which have mock exams.

All the best
-Harish
since u are using System.out.println(m) in side loop the value of m
which is =1 for first time
the =2 for next time
so values 1 and 2 are printed.
-Harish
Of course this happens when u say
int m=0;
U haven't declared 'm' here so it gives error
[This message has been edited by Harish Babu.N (edited December 17, 2000).]
Hi rob
where can i get the JLS.can u give me the link.
23 years ago
Hi
Package is nothing but a collection of classes.It's one way of organising u'r class files.Placing class files in pacakage also avoids conflict between classes of same names but diffrent purpose,if they are in default package.
Hi
When does a class gets loaded?Is it when import statement is found or when u call a constructor or when u call method in the class.
Thanks in advance
23 years ago
That means if i extend a base class,and create a object of sub class will a new object of base class is created?
23 years ago
public class AQuestion
{

public static void main(String args[])
{

System.out.println("the abs value is " + Math.abs(Integer.MIN_VALUE));
}
}

on running the program o/p -2147483648 is shown even after saying abs(int).why is this?
23 years ago
Hi
Bug in u'r code
Use
String result = deciStrings[deci-1] + "-" + uniStrings[uni];


Originally posted by Sean MacLean:
[B]Preeti,
Since this looks an aweful lot like a question in the JavaRanch CattleDrive, I'll only give you bits of the code to do this. So here it goes. There is no built in facility in Java to do this type of conversion. You have to do it by 'hand'. The simplest way is to use the / division and % (mod) operators to determine the rank of the numbers. For instance,

int deci = 22 / 10; // equals 2 because it's integer division
and then
int uni = 22 % 10; // equals 2 because that's the remainder
Now set up two arrays like this,

and get the String representation as such,
String result = deciStrings[deci] + "-" + uniStrings[uni+1];
Of course, you have to derive the logic to make this handle any number. Hope this helps.
Sean[/B]


23 years ago