Skip to main content

Posts

Loop Statement In Java:-

It is used to print large statement of data using single repeatable block.Loop is also called control Structure because it can control repeated data using condition. Type of Control Structure:- 1 Entry Control:-    First Check Condition Then Execute Statement ,    Example of Entry Control:-    1.1 While Loop:-          init;          while(condition)         {                  statement;                  increment;          }    WAP to calculate factorial of any entered number using complete expression? 5  :-  5*4*3*2*1=120      public class HelloWorld{      publ...

What is Data Structure?

Data structure is  a technique which is used to arrange the data using different data pattern ,it is mostly used to manage internal memory management of program,each and every programming language use data structure concept to implement data storage. Type of Data Structure:- 1 Linear Data Structure:-   1) Array  :-       1,.1)  Array implementation to Add,Edit ,Delete Items from beginning,specific position and last       1.2)  Array With Stack      1.3)   Array With Queue   2) LinkedList:-      2.1)  LinkedList implementation to Add,Edit,Delete Items from begining,specific position and last.     2.2)  LinkedList to Stack     2.3)  Linked to Queue         2 Non-Linear Data Structure  2.1) Tree 2.2) Graph ............................................................................

Switch Statement In Java

Switch Statement In Java:- It is called Jumping Statement in Java because we can jump into particular case according to option . Switch provide group of options and we can jump into particular option. switch(option) {      case option value:           statement           break      case option value:         statement         break      default:         statement;         break; } At run-time option will match from option value ,if option==option-value then that statement will be executed. WAP to check even | odd using Switch Statement? public class Main {     public static void main(String[] args) {        int num=5;   ...

Conditional Statement in Java or IF--else Statement

Conditional Statement in Java or IF--else Statement:- This statement provides a separate block of code for true condition and false condition using if statement, else if statement and else statement. Type of Conditional Statement:- 1 Simple If:-    if(condition)    {         statement;    } WAP to increase the salary of employees from 500, if entered salary will be less then 20000 otherwise the same salaries will be displayed? if(salary<20000) salary = salary+500 System.out.println(salary); note:-  if we not use  { } then if will consider only single statement.if we want to consider more then one statement then we use {}. if(condition) { } means it will contain multiple statements. 2 If--else:-   It will work when the condition will be true and false. if block for true condition and else block for the false condition.   If(condition)    {       statement;  ...

operator in java?

Operator concept in java? It is used to perform an operation using operand, Operator is used to solving the mathematical,conditional, logical expression. The operator will be defined as a method but it will be accessed using symbols. For example, if we use the + operator then + has defined as +() in the Java library. Type of Operator in Java:- 1)Unary Operator:-   It will use single operand to perform operation,   1.1) Increment      post a++ ,pre ++a    (a is the operand or variable)   1.2) Decrement     Post  a-- ,Pre --a Post Increment:-    First perform other operation then increase value Pre Increment:-    First increase value then perform other operations. Some Important example of Increment|Decrements: class IncrDemo {    public static void main(String args[])    {       int a=2,b=3;     //  b=a++;   //first assi...

Data Type Concept in Java?

Datatype :-   It is used to represent pattern and size of data in memory .Datatype always will be used in variable,constant ,method ,array etc. Java Support all datatype of C and C++ Language:- Type of datatype:- 1 Primitive:-   1.1) byte:-  1 byte   1.2) int :-   4byte   1.3) float :- 8byte   1.4) double:-  16byte   1.5) char:- 2byte   1.6) boolean :-  1byte 2 Non Primitive:-    It's size is not fixed ,it's depend on memory type and data.   2.1 Object  ---> Common Type which contain all type data    Object o=10;   2.2 String  ---> Collection of Chars   2.3 StringBuffer  2 .4 StringBuilder  2.5 Integer  2.6  Float  2.7 Array  2.8 Collection  2.9 DateTime  2.10 enum ........................................................................................ QUESTION :-  Why java is not 100% Object Oriente...

OOP'S Concept in Java:-

OOP'S:- OOP'S means Object oriented programming structure ,it is used to create real world based application using set of rules and features.  Rules                                                          Features  Class and object                                        All Features  Data abstraction                                        Accessibility,Security  Data Encapsulation                                    Security   Polymorphism                        ...