hi, to all i was thinking how i can create a class that the connection string will be stored there.

now i have 4 files the teamSystem.java, login.java, and main.java, and connect.java.
the connection string should be written on the connection.java, now i want that other 3 files should communicate with the connect.java what i mean is that i will not write the code anymore in the other 3 files something look like the include statement code for jsp but i dont know how to use it in java application.

i will appreciate for any help.
i am sorry for my bad english.

thank you

6 Years
Discussion Span
Last Post by ZER09

Are you asking how to define global constants in one class that can be used in other classes?
Define a class with variables:
class TheGlobals {
final static public <type> <name> = ....

To use a variable: TheGlobals.<name>

Edited by NormR1: n/a


Thank you for the help, it is working now.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.