Hi,
I am running below example
http://www.avajava.com/tutorials/lessons/what-is-the-transient-keyword-used-for.html
I created the TransientDemo.java file under below folder
C:\Users\Desktop\gpfolder\
gpmy\Sampl
eCode\Onli
ne\avajava
\stuff
The TransientDemo.java file has package called cakes.
package cakes;
import java.io.FileInputStream;
import java.io.FileNotFoundExcept
ion;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream
;
import java.io.Serializable;
public class TransientDemo {
public static void main(String[] args) {
I opened command prompt in my windows laptop went to below folder
C:\Users\Desktop\gpfolder\
gpmy\Sampl
eCode\Onli
ne\avajava
\stuff
so now I gave compile below command
javac TransientDemo.java (i see class file generated at C:\Users\Desktop\gpfolder\
gpmy\Sampl
eCode\Onli
ne\avajava
\stuff)
and run command at same location (C:\Users\Desktop\gpfolder
\gpmy\Samp
leCode\Onl
ine\avajav
a\stuff)
java TransientDemo
I got error message saying the class not found.
when I comment the package statement everything works perfect.
//package cakes;
import java.io.FileInputStream;
import java.io.FileNotFoundExcept
ion;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream
;
import java.io.Serializable;
public class TransientDemo {
public static void main(String[] args) {
so now again I gave compile below command
javac TransientDemo.java (i see class file generated at C:\Users\Desktop\gpfolder\
gpmy\Sampl
eCode\Onli
ne\avajava
\stuff)
and run command at same location (C:\Users\Desktop\gpfolder
\gpmy\Samp
leCode\Onl
ine\avajav
a\stuff)
java TransientDemo
I got output without error.
Can you please advise what is the issue with package statement.
what is meaning of file extension of mydemo.ser.
what are practical uses of the transient
please advise
Any links resources ideas highly appreciated. Thanks in advance
you mean below statement instead of above to compile it
javac cakes.TransientDemo.java
Or you mean the run statement itself when you say second statement as below.
>>The second statement tells java to find the class called TransientDemo in the cakes folder.
Please advise