Posts

Java Program To Calculate Area Of Circle

class AreaOfCircle {    public static void main ( String args [ ] )       {                   Scanner s = new Scanner ( System . in ) ;                     System . out . println ( "Enter the radius:" ) ;          double r = s . nextDouble ( ) ;            double    area = ( 22 * r * r ) / 7 ;           System . out . println ( "Area of Circle is: " + area ) ;            } } Output: Output: Java 1 2 3 Enter the radius 1 2 3 Enter the radius : 7 Area of circle : 154.0

WAP in java to check odd-even

import java . util . Scanner ; class CheckEvenOdd { public static void main ( String args []) { int num ; System . out . println ( "Enter an Integer number:" ); //The input provided by user is stored in num Scanner input = new Scanner ( System . in ); num = input . nextInt (); /* If number is divisible by 2 then it's an even number * else odd number*/ if ( num % 2 == 0 ) System . out . println ( "Entered number is even" ); else System . out . println ( "Entered number is odd" ); } } Output 1: Enter an Integer number : 78 Entered number is even Output 2: Enter an Integer number : 77 Entered number is odd

Features of Object Oriented Programming Language

OOPS features: (i)Class:-> Class is a blueprint or prototype which contains within itself data and method.At run the instance of class called Object are created to show the properties of Class. (ii)Object:-> Object are the instance of class. At run the instance of class called Object are created to show the properties of Class. (iii)Abstraction:-> It is the act of representing essential features without going to its background details. (iv)Encapsulation:-> It is the method of wrapping data and method under one head or one unit is called encapsulation, (v)Polymorphism:-> Poly means 'many' morphism means 'to form'. When one task is performed by different ways i.e. known as polymorphism. For example: to convince the customer differently, to draw something e.g. shape or rectangle etc.

Object Oriented Programming

What is Object Oriented Programming? =>Object Oriented Programming language is a modular approch which allow the data to be applied within an stipulated prpgram area.Its provide reusabiltiy of code. Feature of OOPS Object Class Inheritance Polymorphism Abstraction Encapsulation

Types of Errors in Programming

Types of Errors in Programming (i)Synatx error(grammartical error) (ii)Semantic error(logical error) (iii)Runtime errror(execution error)

Difference Between Compiler and Interpreter in Java

Compiler Interpreter It considers the completion of your program as input for converting to machine code. It considers 1 statement in your program at a time as input for converting to machine code. It usually generates intermediate code in the form of the object file (.obj). It doesn't create an intermediate object (.obj) code. Faster execution of control statements as compared to the interpreter. Slower execution of control statements as compared to the compiler. Detected errors in the program get displayed after the entire program is read by compiler. Detected errors in the program get displayed after each instruction read by the interpreter. Example: C++, Java. Example. BASIC, Python, PHP.

First Program of Java

class program1 {     public static void main(String args[])     {         System.out.println("Hello Programmer's");      } } Output:Hello Programmer's