News:

MyKidsDiary.in :: Capture your kids magical moment and create your Online Private Diary for your kids

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

Quick Reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it has been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

Shortcuts: ALT+S post or ALT+P preview