VB. net c # and Java knowledge Summary (1)

Source: Internet
Author: User

2. Variable declaration:

VB. NET:VB.net: Dim variable name as type name [= initial value] [, variable name as type name [= initial value] [,…]

C #: type name variable name [= initial value] [, variable name [= initial value] [, variable name [= initial value] [,…];

Java: type name variable name [= initial value] [, variable name [= initial value] [, variable name [= initial value] [,…];

Example:

VB. NET: dim nvalue as integer

C #: int nvalue;

Java: int nvalue;

3. Constant declaration:

VB.net: constConstant name as type name = value [, constant name as type name = value [,…]

C #:ConstType name constant name = value [, constant name = value [, constant name = value [,…];

Java:FinalType name constant name = value [, constant name = value [, constant name = value [,…];

Example:

VB.net: Const PI as single = 3.1415926

C #: Const float Pi = 3.1415926;

Java:Final float Pi = 3.1415926;

4. object-oriented declaration:

Example:

VB. NET

Namespace evacn' domain

{Public class factory

Inherits building 'parent class

Implements iworker Interface

{

Public sub new () 'Constructor

'.....

End sub

 

Public sub finalize () 'destructor

'.....

End sub

 

Interface functions implemented by public overrides sub work implements iworker. Work

'.....

End sub

Public Function getname as string 'member function

Return ""

End Function

 

}

}

 

 

C #

Namespace evacn

{

Public class factory: Building, iworker

{

 

Public String getname ()

{

Return "heh ";

}

}

}

 

 

Java:

Package evacn;

Interface iworker {

Void work ();

}

Class factory extends building implements iwork {

Public Factory ()

}

Public finalize (){

'....

}

Public void work ()

{

 

'....

}

Public String getname ()

{

Return "heh ";

}

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.