Basic concepts of programming.
Today we are going to learn some basic concepts of programming this concepts are applicable on all programming languages.
So, Lets begin....
Basic Concepts of Programming.
*Variable.
It is a symbolic name or reference to some kind of information.
A variable is a virtual container whose value can
change over a period of time.
int roll = 10; // roll is a variable
*Conditional Statements.
These are expressions that ask the program to determine if a variable is true or false.
There are two possible ways:
1. True – Action1
2. False – Action2
*Looping and Iteration
Iteration is any time a program repeats a process or sequence.
*Datatypes
Data types help classify what information a variable can hold and what can be
done with it.
Numbers
Decimal
Booleans
Characters
Strings
*Functions
These are self contained modules of code that accomplish a particular task.
Methods with no return type :
public void add(int num1, int num2){
int sum = num1 + num2;
System.out.println(“Sum of two numbers are : ”+sum);
}
Methods with return type :
public int add(int num1, int num2){
int sum = num1 + num2;
return sum;
}
Comments