Afaq Ahmad Khan

Java switch

Java switch statement is used to select one of many code blocks to be executed. How to Java switch works:

Matching each expression with case
Once it match, execute all case from where it matched.
Use break to exit from switch
Use default when expression does not match with any case

Java if else

if Statement Use the if statement to specify a block of Java code to be executed if a condition is true. if (condition) { // block of code to be executed if the condition is true } Sample program with if Write a program or WAP to find a number is greater or not. class […]

Java Comments

Java Comments can be used to help for description the code. It will never show on run time. Single-line comments It starts with two forward slashes (//). Java Multi-line Comments. More than one line comments start with /* and ends with */.

Java Type Casting or Type Conversion

Type casting is when you assign a value of one primitive data type to another type. In Java, there are two types of casting:
Widening Casting (automatically) – converting a smaller type to a larger type size

History of Computer

Babbage’s Analytic Engine (Charles Babbage)-1833

Mechanical, digital, genral purpose
Was crank-driven
Could store instruction
Could perform mathatical calculation
Had ability to print
Store data with Punch Card

Types of computer

Analog Computer An analog computer is a form of computer that uses the continuously changeable aspects of physical phenomena Digital Computer A Digital Computer that performs calculations and logical operations with quantities represented as digits, usually in the binary number system. Hybrid Computer Hybrid computers are computers that exhibit features of analog computers and digital […]

Java Variables

Variable allocates reserved memory area. char ch=’A’;//chis variable | int num=10;//num is variable | Types of Variable 1-Local Variable is declared inside the method. 2-Instance Variable is declared inside the class but outside the method. 3- Static variable is declared as with static keyword.

Java Keywords

A keyword is a reserved word. You cannot use it as a variable name, constant name etc. Ex: int, char, float, for, while etc.

Java Operators

Java Operators is a symbol which is used to perform operations. Java Operators has defined such as unary operator, arithmetic operator, relational operator, shift operator, bitwise operator, ternary operator and assignment operator. Java Arithmetic Operators Java Arithmetic operators are used to perform common mathematical operations. Operator Name Description Example + Addition Adds together two values […]

Java Data Types

Data types in Java:1- Primitive data types: The primitive data types include boolean, char, byte, short, int, long, float and double.
2- Non-primitive data types: The non-primitive data types include Classes, Interfaces, and Arrays.

1 31 32 33 34 35