Preetham M

Greenhorn
+ Follow
since Sep 18, 2002
Merit badge: grant badges
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 Preetham M

yeah, the junk looks like the first two bytes which specify the length.
Thanks, i used writeBytes() and that got rid of the junk.
21 years ago
Hi all:
I am using the below code to write a string in to a file in Linux.
//**********
DataOutputStream outputStream;
outputStream = new DataOutputStream(new FileOutputStream(HomeDir + "/state.txt"));
outputStream.writeUTF("Hey asfssa");
outputStream.close();
//*******
the file is created and no exception is thrown. However, upon opening the file, i see that the string is preceded by a few junk charecters.
Why does this happen.
Also, i am not able view the file in the application gedit but vi shows me the data along with the junk.
Appreciate the help.
Thanks,
Preetham M
21 years ago
So if i need to make a jump, its not possible in java..
21 years ago
Hi all:
I have the code:
class A{
.
.
public void asd()
{
StartEx:
int i;
.
.
goto StartEx;
}
}
When i compile the code i get the error..
'.class' expected
int i;
^
illegal start of expression
goto StartEx;
^
Could somebody help me with why the error occurs.
Thanks,
Preetham.
21 years ago
Hi All:
I have a fundamental question on sending data thru sockets.
I have a class, class A { int a; int b;}
I have created an object where i have initialised it to some specific values in my main class. I would now like to send this data to another socket. can i send the contents of the class as a single unit, or must i break it down n send it byte by byte.
I am currently using out.write()to send data.
Would appreciate the help.
Thanks,
Preetham.
21 years ago
Hi All,
Could somebody help me with converting my .class file to a linux executable. Would also help if you could tell me how i could also create a win exe(.exe) from .class
Appreciate the help.
Thanks,
Preetham.
21 years ago
Thank you, that was exactly what i did.
However, is it possible for me to sychronize the variable, such that the data integrity is maintained.
21 years ago
Hi All:
I have a fundamental question on how can two different classes set a particular variable in the parent class.
Eg:
class A {
int var;
B b = new B();
C c = new C();
}
class B{
void xyz(){
//set var
}
}
class C{
void asd(){
//set var
}
}
If i have 3 classes as i have shown above, is it possible for them to access the variable "int var" in class B abd C and set and reset them maintaining data concurrecy.
Thanks,
Preetham.
21 years ago
You could use the Dynamic Programming Algoritham(LCS, Longest Common Sequence) to calculate the longest sub-string of a string.
21 years ago
Since you have all the required files already present in the classpath /home/myself/Release1, when you compile the file present in release2, it looks for the necessary files in the classpath and since they are present in Release1 in the classpath, it uses them to compile your file in Release2.
Remove the Release1 from your directory and it will not compile, unless all your files are not present in the current directory.
Hope it helps,
thanks,
Preetham.
21 years ago
Hi All:
Im have a question on referencing a class within a static method.
I have the below code:
public class Main
{
A atest;
public static void main(String[] argv)
{
atest = new A();
}
}
class A
{
int i;
}
This code does not comile, it gives the error:
non-static variable cl cannot be referenced from a static context.
however i move
A atest;
inside main(),like:
public static void main(String[] argv)
{
A atest;
atest = new A();
}
i get no comilation error.
Could somebody tell me why.
Appreciate the help.
thanks,
Preetham.
21 years ago