Skip to main content

Posts

system out println

System.out.println():-  System.out.println(“javaindore.blogspot.in”);   , will display message written in double quotes on the standard output device that is system screen or monitor. Here System is a java class, declared in lang package like java.lang.System, here java is main package and lang is a sub package. In java System class is declared as a public and final, due to public declaration everybody can happily access these class members but due to final declaration nobody can inherit this class or nobody can override System class methods. All the methods of System class are public and static so everyone can access all the methods using class name like classname.method. For example:   public static void exit (int)   is a method of System class then using  System. exit (0)   anyone can use. System class not provided public constructor so directly we cannot create object of System class. System class in java:-  ...

java data types

Data Types:- In java data types are divided into two parts.  primitive data types   secondary data types Primitive data types:- there are total eight data types into java and there wrapper classes.             Data type Wrapper classes byte Byte short Short int Integer long Long float Float double Double char Character boolean             Boolean In the real world we have many types of data exist like 10,106,100,500.50, 100.10,”javaindore”,’A’,’5’, true and false. Here 10,106 and 100=========whole number [byte, short, integer and long]. 500.50 And 100.10===========floating number [float and double]. ‘A’ and ‘5’              ============character [character]. true and...

Operators

Operators:- operators are used to perform some logical or mathematical operations. Types of Operators:- 1.      Arithmetic Operator (a)   Binary Arithmetic (b) Unary Arithmetic 2.      Relational Operator 3.      Logical operator 4.      Bitwise operator 5.      Ternary or conditional operator 6.      instanceof  operator 7.      comma operator 8.      assignment operator 9.      dot operator Binary Arithmetic:- Binary arithmetic operator operates on two operands. Operators are +,-,*, /, %.example like 5+2, 5-2, 5*2, 5/2, 5%2. Example1:- TestOperator.java class TestOperator { public static void main(String[]args) { int a=10,b=5; System.out.println("Addition:"+(a+b)); System.out.println("Subtraction:"+(a-b)); System.out.println("Multiplication:"+(a*b)); ...