Rajiv Chelsea wrote:Why cant consructors be marked final and absract?
Rob Prime wrote:The disadvantage of using those is that you'll need to store the entire byte into memory.
Anna Smalska wrote:Hello,
Using pipedoutputstream and pipedinputstream is the best way of converting outputstream into inputstream,
Campbell Ritchie wrote:Nor did I.
André Asantos wrote:Hi Masa,
thanks a lot for you attention... But sorry I did not understand your answer...
André Asantos wrote:Which situations are possible the use of transient, synchronized, native and protected modifiers?
Rahul Nair wrote:
Thank you very much for solution. I want to know... can we load User defined classes using the primordial class loader and Standard java classes using User Defined Class Loader ? I mean is it permissible ?
James Sabre wrote:
Masa Saito wrote:This is the most platform independent way to handle new lines:
public static final String NEW_LINE = System.getProperty("line.separator");
That techniques asks the OS "hey this is the jvm. how do you start a new line in a string in your environment?" and so no need to hardwire any characters "\n" or "\r" or otherwise.
Sorry but that is not platform independent. The end-of-line character(s) depend on where (or how) the file is created and not where the file is processed. If I create the file on *nix using a standard *nix editor, transfer in binary mode to Windows then the end-of-line character is not System.getProperty("line.separator"); .
There is no truly platform independent approach but I would use the heretical approach of using a regex looking for "\r\n" or "\r" or "\n" .
krishna Karthikk wrote:
If my class has to be initialized,
krishna Karthikk wrote:then the main method should be accessed using an object.
krishna Karthikk wrote:If there are two instances of main method
krishna Karthikk wrote: the jvm will confuse. If the main method is declared as static then only one single copy of main exists.
Jim Hoglund wrote:
Jim Hoglund wrote:... non-static code operates only on instance variables. ...
Quoting my error here, (I was rushing to leave for dinner) this certainly is not true.
Non-static code has access to ALL its class members. Is it correct to say that labeling
a method static restricts its access to only other static members?. The main purpose
of my post was to address duplication of method code.
Jim ... ...
Jim Hoglund wrote:Each object has state as stored in its assigned copy of instance variables. The class
itself also has state that's stored in the class (static) variables. The JVM loads just
one copy of each constructor, method and initialization block. Static code can operate
only on the class variables while non-static code operates only on instance variables.
krishna Karthikk wrote:Hi everybody, I am Krishna, suddenly I got a doubt, why main function is declared as static. I know that java calls the main function using the class name. If a method has to be called using class name it must be declared as static. So we declare main as static while coding.
The java developers can initialize my java class and call the main method using an object. Why they designed the architecture in this way. Is there any specific reason. One of my friend said that if we declare a function as static it will have only one copy n the memory and something. I did not understand that.
Can anyone tell me why main is declared as static?