Professional Documents
Culture Documents
Language Fundamentals
LEVEL – LEARNER
Icon Used
Check Your
Test Your Understanding Overview Objective Understanding
2
Overview
Hi guys !!
You are already aware of the language fundamentals
(Use Primitive Data Types Define, declare & initialize
variables ,Identify Literals, Convert & Cast Primitives
and Use Operators) in your Primary Track (c#/Java).
3
Objective
4
Check Your Understanding
Hey guys!!!
Let me check your understanding on Keywords that you learnt in your
primary language (Java/C#).
• What is Keyword?
• Why it is being used?
• What is the function of enum key
word?
5
Just a Minute
6
Key words
7
Comparing Keywords in C# & Java
8
Comparing Keywords in C# & Java
9
Comparing Keywords in C# & Java
10
Comparing Keywords in C# & Java
C# keyword Java Keyword C# Example Java Example
//A is a subclass of B public class A extends B
: extends {}
public class A :B
{}
//A implements I public class MyClass
: implements implements
public class A :I
{} MyInterface1
{ }
11
Data Types
Data types Java Supports C# Supports
Yes; Yes;
8 bit – byte, 8 bit – sbyte
Signed integers 16 bit – short 16 bit – short
32 bit – int, 32 bit– int
64 bit –long 64 bit – long
Yes;
8 bit - byte
Unsigned integers NA 16 bit – ushort
32 bit – uint
64 bits – ulong
Character char char
Date/time reference type - java.util.Date reference type – System.DateTime
float(IEEE 754 binary32 floating point float (32 bit) float (32 bit)
number)
double(IEEE 754 binary64 floating point double (64 bit) double (64 bit)
number)
Boolean type boolean bool
Strings Immutable reference type, Immutable reference type,
Unicode – java.lang.String Unicode - string
Single, Multi-dimensional, Jagged
Arrays Single & Multi-dimensional Arrays
Enumerated types Yes; reference type (enum) Yes; scalar (enum)
12
Lend a hand
Please answer the questions below :
13
Lend a hand Solution in C#
//Write a program to demonstrate class and object in C#.NET
Using System; //Commonly used data types are included in system directives
namespace LanguageFundamentals
{
public class Person
{
private string name; // Field is declared as a private variable
16
Best Practices for Language fundamentals in C#
17
Best Practices for Language fundamental in Java
19
Summary
Summarizing the topic in the below following:
20
Source
• http://javatheory.blogspot.in
• http://msdn.microsoft.com/en-us/library/seyhszts.aspx
• http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Java
Disclaimer: Parts of the content of this course is based on the materials available from the Web sites and books
listed above. The materials that can be accessed from linked sites are not maintained by Cognizant Academy and
we are not responsible for the contents thereof. All trademarks, service marks, and trade names in this course are
the marks of the respective owner(s).
21
Language fundamentals
23