Monday, 2018-02-19
BioInfo Pakistan
Site menu
Section categories
JAVA Online Course [6]
This Category Is To Support Our First Free Online JAVA Course.
Our poll
Pakistani Student
Total of answers: 0
Chat Box
Statistics

Total online: 1
Guests: 1
Users: 0
Home » 2011 » September » 2 » Lecture 1 Page 2
10:07 PM
Lecture 1 Page 2


Now Some Basic Examples

1. Basic Data Types:
   Every variable has some data type in JAVA, this data type decides what this variable will store. Some basic data types are as follows:
  • String: As name describes it is used to store strings(Sequence of alphabets) in it. It is used as String s = "Its JAVA course";
  • int: as name shows it stores integer value. It can't store decimal value e.g int a = 20;
  • float and double: These two data types are used to store decimal values, difference in them is the usage of memory. More you will learn with time. It can be used as float x = 2.99;
   
2. Simple Program That Uses Strings:
  • Make new project named StringTest as described before.
  • Write following commands in main method.
    • String x = "Java ";
    • String y = "Course";
    • String z = x+y;
    • System.out.println(z);
  • Test this and try different such statements.
3. Simple Calculations:
  • Make new project named BasicMaths as described before.
  • Write following commands in main method.
    • int a =12;
    • int b =3;
    • int c,d,e,f,g;
    • c= a+b;
    • d= a*b;
    • e= a-b;
    • f= a/b;
    • g= a%b;
    • System.out.println("Addition : "+ a +" + "+ b +" = "+ c );
    • System.out.println("Multiplicaton : "+ a +" * "+ b +" = "+ d );
    • System.out.println("Subtraction : "+ a +" - "+ b +" = "+ e );
    • System.out.println("Division : "+ a +" / "+ b +" = "+ f );
    • System.out.println("Remainder : "+ a +" % "+ b +" = "+ g );
  • Test this and try different such statements.

For Discussion I Will Be Online After 9 PM
(Pakistan) Daily.
You Can Also Leave A Thread At FORUM Which Will Be Answered In 24 Hrs.
Your Assignment After This Lecture Is To Practice All These Tasks And Give Some New Examples At FORUM.

Next Lecture Will Be On Tuesday.


Category: JAVA Online Course | Views: 557 | Added by: Ansari | Rating: 0.0/0
Total comments: 1
1  
You can download discussed project from forum.

Forum

Name *:
Email *:
Code *:
Log In

Search
Calendar
«  September 2011  »
SuMoTuWeThFrSa
    123
45678910
11121314151617
18192021222324
252627282930
Entries archive
Site friends
Copyright MyCorp © 2018
Free website builderuCoz