Submitted by ankit.chauhan on Thu, 03/06/2014 - 13:03
What is MVC (Model View Controller)?
MVC is an architectural pattern which separates the representation and user interaction. It’s divided into three broader sections, Model, View, and Controller. Below is how each one of them handles the task.
- The View is responsible for the look and feel.
- Model represents the real world object and provides data to the View.
- The Controller is responsible for taking the end user request and loading the appropriate Model and View.
Can you explain the complete flow of MVC?
Below are the steps to control flows in MVC (Model, View, and controller) architecture:
- All end user requests are first sent to the controller.
- The controller depending on the request decides which model to load. The controller loads the model and attaches the model with the appropriate view.
- The final view is then attached with the model data and sent as a response to the end user on the browser.
HTML is the "mother tongue" of your browser.
To make a long story short, HTML was invented in 1990 by a scientist called Tim Berners-Lee. The purpose was to make it easier for scientists at different universities to gain access to each other's research documents. The project became a bigger success than Tim Berners-Lee had ever imagined. By inventing HTML he laid the foundation for the web as we know it today.
A literal is a source code representation of a fixed value. They are represented directly in the code without any computation.
Literals can be assigned to any primitive type variable. For example:
byte a = 68;
char a = 'A'
byte, int, long, and short can be expressed in decimal(base 10),hexadecimal(base 16) or octal(base 8) number systems as well.
Prefix 0 is used to indicates octal and prefix 0x indicates hexadecimal when using these number systems for literals. For example:
int decimal = 100;
int octal = 0144;
int hexa = 0x64;
Pointer is used to store the address of variable in computer memory. The computer memory is a sequential collection of storage cells, each cell has a unique address associated with it.
A function is a self contained block of code that performs a particular task.
Two type functions
1. Library function
2. user defined function
1. Library function: Those function which are already declare in c library. We need to call them in our program. Library functions are in-build. These are not required to written by user. For example sqrt(), pow().
2. User defined function: user defined function have to be developed by the user. Main( ) is a user defined function which we will apply many different formulas.
Array is a collection of similar data types of char, int , float etc. array are a data structure which hold sequence of objects all of which have same type.
Array has two types
1. One Dimensional Array
2. Two Dimensional Array
Java supports single line and multi-line comments very similar to c and c++. All characters available inside any comment are ignored by Java compiler.
public class MyFirstJavaProgram
/* This is my first java program.
* This will print 'Hello World' as the output
* This is an example of multi-line comments.
public static void main(String args)
// This is an example of single line comment
/* This is also an example of single line comment. */
When we consider a Java program it can be defined as a collection of objects that communicate via invoking each others methods. Let us now briefly look into what do class, object, methods and instant variables mean.
• Object - Objects have states and behaviors. Example: A dog has states-color, name, breed as well as behaviors -wagging, barking, eating. An object is an instance of a class.
• Class - A class can be defined as a template/ blue print that describe the behaviors/states that object of its type support.
James Gosling initiated the Java language project in June 1991 for use in one of his many set-top box projects. The language, initially called Oak after an oak tree that stood outside Gosling's office, also went by the name Green and ended up later renamed as Java, from a list of random words.
Sun released the first public implementation as Java 1.0 in 1995. It promised Write Once, Run Anywhere (WORA), providing no-cost run-times on popular platforms.
A statement that allow a set of instructions to be performed repeatedly are iteration statement. They are also called loops.
Do while loop
For loop has several capabilities. In for loop you want to have a group of statement to be executed number of times.
for(initialization; condition; increment or decrement)
Nested for statement:
Copyright © 2014 Itgyankosh.com