Posts

Showing posts from July, 2015

Important Basics of Java Programming Language

Hello Guys.... This is my first post and in this i am going to talk about some of the important basics and concepts of Java Programming Language which are generally ignored by most of us... I hope that after reading this post many basic concepts regarding java will be cleared to you.So let's get started:-   1. Automatic Type Promotion  Consider this code :-  public class promotion {     public static void main(String args[])     {         byte a=10;         byte b=2;         byte c=a*b;         System.out.println("Result of 10x2 = "+c);     } } When we  run this code in a file named promotion.java we get the error as follows :- Exception in thread "main" java.lang.Error: Unresolved compilation problem:     Type mismatch: cannot convert from int to byte     at promotion.main(promotion.java:7) So why do we get this error ???? as we know that the range of the byte is 256 and the multiplication of  'a' and 'b' is 20 whi