■》Variables & Data Types & constant -> ● Variables-> ○ A variable is a container (storage area) used to hold data. ○ Each variable should be given a unique name (identifier). ■ Program-> public class Main { public static void main(String[] args) { // Variables String name = "ved"; int age = 19; float price=399.50; String neighbour = "duggu"; String friend = "shourya"; } } ● Data Types-> Data types are declarations for variables. This determines the type and size of data associated with variables which is essential to know since different data types occupy different sizes of memory. There are 2 types of Data Types : 1● Primitive Data types : to store simple...
■ what is stack? Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). LIFO implies that the element that is inserted last, comes out first and FILO implies that the element that is inserted first, comes out last. ■ Diagram- ■ real life example- There are many real-life examples of a stack. Consider an example of plates stacked over one another in the canteen. The plate which is at the top is the first one to be removed, i.e. the plate whic...
Comments
Post a Comment