News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

Variables and Constants

Started by sukishan, Sep 04, 2009, 03:51 PM

Previous topic - Next topic

sukishan

Variables and Constants
Constants in J# are prefixed by the final keyword. All the other mechanisms of creating new value types and reference types are similar to those of C#.

package hks;
import System.*;
public class UseVariables
{
  public static void main()
  {
    final String HELLO_WORLD = "Hello World";
    String message = HELLO_WORLD + " in VJ#";
    MyClass mc = new MyClass(message);
    mc.Print();
  }
}
public class MyClass
{
  private String message;
  public MyClass(String message)
  {
    this.message = message;
  }
  public void Print()
  {
    Console.WriteLine(message);
  }
}
A good beginning makes a good ending