Java Programming/Q&A
Welcome to the Java Programming questions and answers page.
Feel free to post any questions you have while learning Java Programming.
If you have questions about this book, post them on the Java Programming discussion page.
If you know the answer to a question, or you can improve any, go ahead and do it.
Ask a question! See that you are logged into Wikibooks
Generics come from other languages, see article on w:Generic programming for more information.
CORBA is language independent "Remote Method Invocation" like RMI. RMI only works with Java, CORBA can be used with any languages. For more information see: w:Common Object Request Broker Architecture.
RMI is much simpler to use than CORBA, so in an only Java environment RMI should be used.
If you need to call methods between different language environments, use CORBA. With CORBA a Java client can call C++ server and/or a C++ client can call a Java server. With RMI that can not be done.
The Vector class can receive any object (so it can not receive primitive types), even different types of data in the same Vector.
The Vector and Hashtable classes are legacy classes that come from the 1.0 version of Java and have enforced synchronized methods resulting in performance issues on systems that does not require this characteristic. Additional classes were added at 1.2, those are ArrayList and HashMap, without synchronization. Both syncronized and not syncronized versions are implementing the List and Map interfaces, respectivelly.
Since Java 1.5, there is Generics, which allows you to specify that you want a container, like an ArrayList, to contain only certain types of things. This allows you to guarantee that what you are getting out of the container is a certain type at compile time, without explicitly casting it. This is safer (you avoid cast errors at run time) and makes your code more readable and understandable. You should use generics whenever possible.
Java applications can be run in the same way as any other program if they are found in .JAR or .JNLP packages. If you are trying to run a .class file, simply open a command line prompt and type java MyClass, where MyClass is the name of the class file you are trying to launch.
The Java String class provides substring() methods that should provide what you need. For example, mid(str, a, b) in Visual Basic would be something like str.substring(a, a+b).
A class is a template to create objects. Methods and variables declared private can not be access outside of the class. Those can be only accessed internally, it means that they are hidden from the outside. It makes programming esier because it is garantide that those internal information won't be messed up by outside code.
No. Keywords are resirved by the compiler and can not be used for variables.
Yes. Singleton constructors are private. When the constructor is private no object of that class can be created outside of that class. How and when an object can be created of that class is defined by that class.
Java uses unicode, while C++ uses ASCII. Unicode consists of a repertoire of about 100,000 characters, which is much more than what the ASCII character-set can represent. See also Java Programming/Syntax/Unicode Source
You can display the value of any variable by using the System.out.print() and System.out.println() functions.
whAT Is thE introduction of java language?
Contents |
[edit] JAVA
HOW I CAN OPEN A JAVA FILE FROM CD?
how objects are created from a class?
out is an object of class PrintStream then why Java define out in System class? for printing message we use System.out.print() method, if out is defined in PrintStream we can also use that method like PrintStream.out.print()?
[edit] Java Virtual Machine
Hi Friends Cud u pls tell me in detail abt the JVM Generations. Thanks & regards Hema26
in the line "System.out.println()"what is exact meaning of System & out?
How declare class in java?
[edit] tracing in core java
how to trace a simple java program!
[edit] question
write java program which calculate the shape of triangle ,square ,and rectangle on three classes?
write a java program to enter 2 numbers and perform all the basic operation of calculator?
[edit] invocation method details
How do we get details of all the methods which are declared and invoke by object references in java class?
public class A{ public void a(){ System.out.println("Hello1"); } }
public class T{ public static void main(String... args){ A a = new A(); a.a(); } }
I would like to get the details of method main() and a() by using T class reference.
How to create and run a .jar program in bluej
This page may need to be