Hello Everybody!
Its very long time no posting here.
This time I'll try to explain about differences between Mr.Java & Mr.C-Sharp
Ok ! Lets check it out!
A. Java Primitive Types
There are 4 datatype on Java Programming Language.
Here it is...
1. Logical --- boolean
Logical values are represented using the boolean type,which takes one of two values : true or false.
Example :
boolean result = true;
This example is to declare a variable which named by "result" as boolean datatype, and give it true value.
2. Textual --- char
This type is representative by single unicode.
You must enclose a char literal in single quotes(' ').
Example :
'a' // The letter a
'\t' // A tab
3. Integral --- byte, short, int, and long
It using decimal, octal, and hexadecimal.
byte = 8 bits
short = 16 bits
int = 32 bits
long = 64 bits
Example :
2 // decimal for integer 2
077 // 0 indicates an octal value
0xBAAC // 0x indicates a hexadecimal value
4. Floating Points --- float and double
"double" is the datatype default.
E or e ==> add exponential value
F or f ==> float
D or d ==> double
Example :
3.14
6.02E23 ==> 23 after E has a positive value, equivalent with 6.02E+23
B. C# Primitive Types
>> Type of Data Type
- Value Types
They directly content data. The example are char, int, and float, which can be used for storing alphabets, integers, and floating point numbers.
- Reference Type
They contain a reference to the variables which are stored in memory. The example is string datatype.
Ok! Thats all a little explaination about Java & C# data type.
From that, we can take some differences between Java and C#
Here it is.
Differences between Java and C# :
- To compare string values in Java,
developers need to call the equals method on a string type
as the == operator compares reference types by default.
In C#, developers can use the == or != operators to compare string values directly.
- Java's boolean is called bool in C#.
- C# supports unsigned in addition to the signed integer types.
Java does not feature unsigned integer types.
Its very long time no posting here.
This time I'll try to explain about differences between Mr.Java & Mr.C-Sharp
Ok ! Lets check it out!
A. Java Primitive Types
There are 4 datatype on Java Programming Language.
Here it is...
1. Logical --- boolean
Logical values are represented using the boolean type,which takes one of two values : true or false.
Example :
boolean result = true;
This example is to declare a variable which named by "result" as boolean datatype, and give it true value.
2. Textual --- char
This type is representative by single unicode.
You must enclose a char literal in single quotes(' ').
Example :
'a' // The letter a
'\t' // A tab
3. Integral --- byte, short, int, and long
It using decimal, octal, and hexadecimal.
byte = 8 bits
short = 16 bits
int = 32 bits
long = 64 bits
Example :
2 // decimal for integer 2
077 // 0 indicates an octal value
0xBAAC // 0x indicates a hexadecimal value
4. Floating Points --- float and double
"double" is the datatype default.
E or e ==> add exponential value
F or f ==> float
D or d ==> double
Example :
3.14
6.02E23 ==> 23 after E has a positive value, equivalent with 6.02E+23
B. C# Primitive Types
Because C# represents all primitive data types as objects, it is possible to call an object method on a primitive data type.
Example :
static void Main()
{ int i = 10; object o = i; System.Console.WriteLine(o.ToString()); }
>> Type of Data Type
- Value Types
They directly content data. The example are char, int, and float, which can be used for storing alphabets, integers, and floating point numbers.
- Reference Type
They contain a reference to the variables which are stored in memory. The example is string datatype.
Ok! Thats all a little explaination about Java & C# data type.
From that, we can take some differences between Java and C#
Here it is.
Differences between Java and C# :
- To compare string values in Java,
developers need to call the equals method on a string type
as the == operator compares reference types by default.
In C#, developers can use the == or != operators to compare string values directly.
- Java's boolean is called bool in C#.
- C# supports unsigned in addition to the signed integer types.
Java does not feature unsigned integer types.
C# so POPULAR?? Why?
Its because :
It really is a great platform for programming. There are numerous improvements over Java, such as:
- Value Types
- Properties
- Delegates and Events
- Global Assembly Cache
- Runtime Generic Support
It's constantly evolving, both in terms of library support and new language features.
Example:
- LINQ (it will change the way you iterate a collection!)
- Lambda Expressions
- Closure