Tuesday, September 27, 2011

Introduction to Advance Java : An starter for Interviewes


This post will introduce the concept of advance java classes. This post introduces several java classes which are highly required during coding in JAVA programming language. This is the first part of “Introduction to Advance JAVA”. This post will discuss the classes, its details and a sample program that how to use these classes in JAVA code.

In this post we are talking about Arrays, File Reader and Writer and a map interface classes. In coming post we will be discussing several other useful classes like database connectivity, transaction management classes and other important things.


1.     Arrays Class
Public class Arrays extends Object

This class contains various methods for manipulating arrays (such as sorting and searching). This class also contains a static factory that allows arrays to be viewed as lists. The methods in this class all throw a NullPointerException if the specified array reference is null, except where noted.

The documentation for the methods contained in this class includes briefs description of the implementations. Such descriptions should be regarded as implementation notes, rather than parts of the specification. Implementers should feel free to substitute other algorithms, so long as the specification itself is adhered to. (For example, the algorithm used by sort (Object []) does not have to be a merge sort, but it does have to be stable.) The following function definition searches the specified array of bytes for the specified value using the binary search algorithm.

static int binarySearch(byte[] a, byte key)

The following program illustrates Array Class implementation.

import java.util.Arrays;
public class ArrayInt {
       public static void main(String[] args) {
int[] a1 = new int[]{4,3,5};
int[] a2 = new int[]{1,3,8,4,5,7};
boolean check=Arrays.equals(a1, a2);
System.out.println("The Contents of the array are as follows");
for(float i:a1){
System.out.println(" ====== "+i);
for(float i:a2){
int index=Arrays.binarySearch(a2,3);
System.out.println("The Index of the given names"+index);

int index1=Arrays.binarySearch(a2,9);
System.out.println("Search is not Successful"+index1);

Arrays.fill(a2, 4, 6,9);

for(int i:a1){
                System.out.println(" ##### " + i);}

2.     File Reader and File Writer


This class is a subclass of Inputstream class that reads bytes from a specified file name. The read() method of this class reads a byte or array of bytes from the file. It returns -1 when the end-of-file has been reached. We typically use this class in conjunction with a BufferedInputStream and DataInputstream class to read binary data. To read text data, this class is used with an InputStreamReader and BufferedReader class. This class throwsFileNotFoundException, if the specified file is not exist. You can use the constructor of this stream as below. Sample function signature is as below which should be used during coding

FileInputstream (File filename);


This class is a subclass of OutputStream that writes data to a specified file name. The write() method of this class writes a byte or array of bytes to the file. We typically use this class in conjunction with a BufferedOutputStream and a DataOutputStream class to write binary data. To write text, we typically use it with a PrintWriterBufferedWriter and an OutputStreamWriter class. You can use the constructor of this stream as below. Sample function signature is as below which should be used during coding

FileOutputStream (File filename);

The following program illustrates Reading data from the File and writes data into the file.

File Read Program
import java.io.*;
class FileReaderDemo {
public static void main(String args[]) throws Exception {
            FileReader fr = new FileReader("out.txt");
            BufferedReader br = new BufferedReader(fr);
            String s;
while((s = br.readLine()) != null) {

File Write Program
package AdvancedIO;
import java.io.*;
class FileWrite
   public static void main(String args[])
        FileWriter fstream = new FileWriter("out.txt");
        BufferedWriter out = new BufferedWriter(fstream);
        out.write("Hello Java");
        }catch (Exception e){//Catch exception if any
      System.err.println("Error: " + e.getMessage());

Relevant AD
This ad may be helpful, if relevant to your search.

3.     Map Interface

The HashMap class uses a hash table to implement the Map interface. This allows the execution time of basic operations, such as get() and put(), to remain constant even for large sets. The following constructors are defined:

HashMap( )
 capacity, float fillRatio)

HashMap implements Map and extends AbstractMap. It does not add any methods of its own. You should note that a hash map does not guarantee the order of its elements. Therefore, the order in which elements are added to a hash map is not necessarily the order in which they are read by an iterator. The following program illustrates HashMap. It maps names to account balances. Notice how a set-view is obtained and used.

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class MapExample {
    public static void main(String[] args) {
        Map<Object,String> mp=new HashMap<Object, String>();
        mp.put(new Integer(2), "100");
        mp.put(new Integer(1), "200");
        mp.put(new Integer(3), "300");
        mp.put(new Integer(4), "400");
        mp.put(new Integer(7), "777");
        mp.put(new Integer(6), "666");
        mp.put(new Integer(5), "333");
        Set s=mp.entrySet();
        Iterator it=s.iterator();

           Map.Entry m =(Map.Entry)it.next();

            // getKey is used to get key of Map
            int key=(Integer)m.getKey();

            // getValue is used to get value of key in Map
            String value=(String)m.getValue();

                     System.out.println("Key :"+key+"  Value :"+value);


  1. com ">The British Association for Cognitive and Behavioural Psychotherapies. This profession also can operate in schools where they will aid the special education classes. In addition, those working in hospitals and physician offices were paid more than those employed in clinics or as social employees.
    Feel free to visit my site :: online Counselling

  2. com ">The British Association for Cognitive and Behavioural Psychotherapies. This profession also can operate in schools where they will aid the special education classes. In addition, those working in hospitals and physician offices were paid more than those employed in clinics or as social employees.
    My site - online Counselling

  3. I’d must check with you here. Which is not one

    thing I often do! I get pleasure from studying a put up that will make individuals think.

    Additionally, thanks for

    permitting me to remark!

    Stop by my homepage - magiciafictions.blogspot.fr
    Check out my blog post : spain weather forecast

  4. whoah this blog is wonderful i love reading your articles.

    Keep up the

    good work! You know, lots of people are looking around for this info, you can aid them greatly.

    Check out my weblog; http://endofwesternciv.blogspot.ru
    My web page: rental homes in houston texas

  5. I simply desired to say thanks once more. I'm not certain what I could possibly have

    created in the absence of the actual basics contributed by you relating to

    such a topic. It became a challenging

    scenario in my circumstances, however , considering the specialised style you treated that

    made me to jump with gladness. I'm happier for this help and then hope

    you are aware of a

    great job you are carrying out

    teaching the others by way of your blog post. Probably you have never come across all of


    my webpage :: wapmaze.com
    My site :: apartment for sale Alicante

  6. Definitely, what a magnificent blog and illuminating
    posts, I surely will bookmark your site.
    Best Regards!

    Look into my blog manimo.pixnet.net
    Feel free to surf my site ; christian dance clothes

  7. Hi would you mind stating which blog platform you're using?

    I'm looking to start my own blog in the near future but I'm having a hard time

    selecting between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is

    because your design and style seems different then most blogs and I'm looking for something unique.
    P.S Apologies for getting off-topic but I had to ask!

    Here is my web-site; www.fotogallery.24to24-hosting.com
    My web page - spain weather climate

  8. I'm extremely impressed with your writing skills as well as with the layout on your blog. Is this a paid theme or did you customize it yourself? Anyway keep up the excellent

    quality writing, it is rare to see a nice blog like this one these days..
    My blog post - www.apisto.pl

  9. I get pleasure from, cause I found exactly what I used
    to be taking a look for. You've ended my 4 day long hunt! God Bless you man. Have a great day. Bye

    Also visit my web blog ... buy phen375

  10. Very nice post. I just stumbled upon your weblog and wished to
    say that I've really enjoyed surfing around your blog posts. After all I’ll be subscribing to your

    feed and I hope you write again soon!
    Also visit my web site : http://bozhyvu.blogspot.com/2011/02/blog-post_738.html

  11. The other day, while I was at work, my cousin stole my iPad and tested to see if it can survive a forty foot drop, just so she can be a youtube sensation.
    My iPad is now destroyed and she has 83 views. I know this is entirely off topic but I had
    to share it with someone!

    My blog - search engine ranking secrets
    my web site: how to increase ranking in google

  12. First of all I want to say terrific blog! I had a quick question which I'd like to ask if you do not mind. I was interested to know how you center yourself and clear your head before writing. I've had a difficult time clearing my
    mind in getting my ideas out. I truly do enjoy writing however it just
    seems like the first 10 to 15 minutes are lost just trying to figure out how to
    begin. Any suggestions or hints? Many thanks!

    Also visit my blog post :: Ranking February

  13. Hey I know this is off topic but I was wondering if you knew of
    any widgets I could add to my blog that automatically tweet my newest
    twitter updates. I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.

    Feel free to visit my web blog - into Community Foundation of Northern Illinois Scholarships

  14. Thank you for the good writeup. It in truth was a leisure account it.
    Look advanced to far added agreeable from you! However, how could
    we be in contact?

    my website the porno website
    my page > a Porn tube

  15. I just like the helpful info you provide to your articles.
    I'll bookmark your blog and check again right here frequently. I am fairly certain I will be informed many new stuff right right here! Good luck for the next!

    My homepage :: nudes

  16. Hi! Do you know if they make any plugins to

    against hackers? I'm kinda paranoid about losing everything I've worked hard on.
    Any tips?
    my webpage > thieme.miscmeta.com

  17. Thank you for another informative website. Where else could I am getting
    that type of info written in such a

    perfect way? I've a mission that

    I am just now operating on, and I have been on the glance out for

    such information.
    Here is my web site ; http://wiki.avik.org.ua/

  18. Fantastic goods from you, man. I've understand your stuff previous to and

    you're just too wonderful. I really like what

    you have acquired here, really like what you're saying and the way in which you

    say it. You make it enjoyable and you still take care of to keep it wise. I

    cant wait to read far more from you. This is actually a terrific site.
    Here is my blog post : pigikeule.popo.lt

  19. Sample Hardship Letter to Help You Achieve a Mortgage Loan Modification calculate car loan louis federal reserve data and $350 billion gap in availability for commercial loans originated: "signs point to tight business lending this year.

  20. Ahaa, its fastidious discussion concerning this piece of writing here at this blog, I have read all that, so now me
    also commenting here.

    my web page - Payday Loans
    My website > Payday Loans

  21. What's up, this weekend is fastidious designed for me, for the reason that this point in time i am reading this fantastic educational piece of writing here at my house.

    my web blog xxx penis dick cunt vagina

  22. This is my first time pay a visit at here and i am genuinely impressed to read all at alone place.

    My site http://Estin.Net/forum/english/id/23427?redirect=Forbid
    my web site: Http://Sns.Cam111.Com/MichaelaA

  23. I really like reading through an article that can make people think.
    Also, thank you for permitting me to comment!

    Also visit my page: Http://teengangbangs.net

  24. This is my first time go to see at here and i am in fact happy to read
    all at alone place.

    My page - [主页]

  25. It's fantastic that you are getting ideas from this paragraph as well as from our discussion made at this time.

    Feel free to visit my web page ... quantim

  26. I leave a comment each time I appreciate a post on a site or if I have
    something to valuable to contribute to the discussion.

    Usually it's caused by the fire communicated in the article I browsed. And on this article "Introduction to Advance Java : An starter for Interviewes". I was actually excited enough to leave a commenta response :) I actually do have 2 questions for you if it's okay.
    Could it be only me or do some of the remarks look like written by brain dead folks?
    :-P And, if you are posting on additional sites, I would like to follow anything new you have to post.
    Would you list every one of all your communal pages like your Facebook
    page, twitter feed, or linkedin profile?

    Also visit my weblog; http://hardfucked.org

  27. Yes! Finally someone writes about fast times at ridgemont high

    Feel free to surf to my web site :: breaking news

  28. I do not even know the way I stopped up here, but I thought this post was once great.
    I don't understand who you might be however certainly you're going to
    a famous blogger if you are not already. Cheers!

    my web page; see more

  29. Рretty niсe рοѕt. I just stumbled uрon your wеblog anԁ wantеd to
    mention thаt I havе rеally enjoyеԁ bгowѕіng
    youг ωeblog poѕts. In anу cаse I wіll be subѕсribing in yοur rss feeԁ аnԁ I am hoping you wrіte again ѵеrу ѕοon!

    my webpagе ... plus bramka
    My webpage > bramka sms

  30. When some one searches for his essential thing, so he/she desires to be available that in detail,
    thus that thing is maintained over here.

    Feel free to surf to my page :: 0 - www.Afroglobe.net

  31. Ηi thеre! I just wanted tο asκ if you eνeг have any issues wіth hacκеrs?

    Ϻy lаst blοg (wordpгesѕ) ωas hacked and I
    enԁеԁ up lοsіng months οf hard woгk ԁue to nо bаck
    up. Do you havе any solutions to preνent hаcκeгs?

    My websіte :: bramka sms
    Also see my webpage :: bramka sms

  32. Thanks for some other informative web site.
    Where else could I get that type of info written in such an ideal approach?

    I've a mission that I'm simply now operating on, and I have been at the look out for such info.

    Here is my web page ... http://Vintagevideos.net/

  33. My partner and I stumbled over here coming from a different page and thought I might as
    well check things out. I like what I see so now i am following you.
    Look forward to looking at your web page for a second time.

    Feel free to visit my website :: click here

  34. I'm gone to say to my little brother, that he should also pay a visit this webpage on regular basis to obtain updated from most up-to-date reports.

    Have a look at my homepage - pussy hat trick three girls five machines shit ton of orgasms bikini

  35. Generally I don't learn article on blogs, however I would like to say that this write-up very compelled me to take a look at and do so! Your writing taste has been amazed me. Thank you, quite nice article.

    Also visit my web page: More

  36. fantastic submit, very informative. I'm wondering why the opposite experts of this sector do not realize this. You should continue your writing. I am confident, you have a great readers' base

    Also visit my web-site :: visit the following page

  37. If you're really not sex cams musically inclined, you can in turn either buy or sell in the market or you can simply plunder from another player or from a barbarian a non player city/town.

    Also visit my web-site: sex cam

  38. I was recommended this blog by my cousin.
    I'm not sure whether this post is written by him as nobody else know such detailed about my problem. You're
    incredible! Thanks!

    my webpage; see more

  39. Hello, everything is going nicely here and ofcourse every one is
    sharing information, that's in fact good, keep up writing.

    My web blog: see more

  40. What's up everyone, it's my first pay a
    visіt at thiѕ web page, and paragrаph is reallу fruitful in favor оf me, keep
    up poѕtіng these types of ρoѕts.

    Feеl fгee to surf to my page darmowe bramki sms play

  41. Whаt's up, yes this article is genuinely fastidious and I have learned lot of things from it concerning blogging. thanks.

    Here is my web page - bramka sms play

  42. Thіs blоg was... how do you say it?
    Releѵаnt!! Finally I have found something that helped mе.

    Feel free to surf to my blog; bramka sms play

  43. Yeѕterԁay, while I waѕ at work, my cousin ѕtole my іΡad and teѕted to
    see if іt сan survive a forty foot ԁroр, just so she can bе
    а youtube sensatіоn. My apple ipad
    is now broken and she has 83 views. I know thіs іs cоmpletеly οff topіc but I
    had to ѕhare it with someonе!

    My ωeb site :: bramka sms play

  44. Writе more, thats all I hаѵe tο saу.
    Litеrally, іt sееms as though уou
    relied on thе ѵideο tο mаke your
    ρoint. You cleaгlу know whаt youre talking abоut, whу wаste уour іntelligеnce on just postіng νideos to your blog
    whеn yοu сould bе giving us somethіng enlightening
    to reaԁ?

    mу homepage; bramka sms

  45. Нey ωoulԁ you minԁ letting me know which ωeb host you're utilizing? I've loaԁeԁ your blog
    іn 3 different broωseгѕ аnd I
    muѕt say thіs blog loads a lot fastеr
    thеn moѕt. Can yоu rеcommenԁ a good hоstіng proviԁer at a reasonable pricе?

    Mаny thаnκs, I appreciatе іt!

    Have a loοk аt my рage; http://www.devlokh.org/node/83321/edit/components

  46. Hey! Do you know if they make any plugins to assist with Search Engine Optimization?
    I'm trying to get my blog to rank for some targeted keywords but I'm not seeing very good
    gains. If you know of any please share. Many thanks!

    Here is my web page :: quantrim weight loss

  47. I used to be able to find good advice from your blog articles.

    my site look what I found

  48. An impressive share! I have just forwarded this onto a
    co-worker who had been conducting a little research on this.

    And he in fact ordered me lunch due to the fact that I stumbled upon it for him.

    .. lol. So allow me to reword this.... Thanks for the meal!
    ! But yeah, thanx for spending the time to discuss this topic here
    on your web site.

    My website ... Link

  49. I really love your blog.. Pleasant colors & theme.
    Did you make this site yourself? Please reply back as I'm wanting to create my own website and would love to know where you got this from or what the theme is named. Appreciate it!

    My blog click here

  50. I don't know whether it's just me or if perhaps everyone else experiencing issues with
    your site. It looks like some of the text within your content
    are running off the screen. Can somebody else please provide feedback and let me know if
    this is happening to them as well? This could be a problem with my web
    browser because I've had this happen previously. Kudos

    Feel free to surf to my homepage - more

  51. Greetings! This is my 1st comment here so I just wanted to give a
    quick shout out and tell you I truly enjoy reading your articles.
    Can you suggest any other blogs/websites/forums that cover the same topics?

    Many thanks!

    Also visit my homepage ... visit

  52. Each Sunday, a group fleshlight of teenage boys and
    allegedly urinating on a hat belonging to one of them.

  53. It's really a great and helpful piece of info. I am glad that you just shared this helpful information with us. Please stay us informed like this. Thanks for sharing.

    Feel free to visit my web blog See More

  54. Highly descriptive blog, I loved that a lot. Will there be a part 2?

    my web-site http://xiglute.com/blogs/17301/19062/what-do-adult-photographers-thin

  55. Everything is very open with a really clear description of the challenges.

    It was definitely informative. Your website is extremely helpful.
    Many thanks for sharing!

    Take a look at my web-site ... ehl.ru

  56. Hi there to all, it's genuinely a good for me to pay a quick visit this website, it includes precious Information.

    Also visit my site ... his response

  57. Hi it's me, I am also visiting this web site daily, this web site is really good and the visitors are really sharing fastidious thoughts.

    Here is my weblog :: right here

  58. Hmm is anyone else encountering problems with the pictures
    on this blog loading? I'm trying to determine if its a problem on my end or if it's the blog.

    Any suggestions would be greatly appreciated.

    Feel free to surf to my web-site Is Only 18 Too Young For Women To Join The Military

  59. Appreciation to my father who told me concerning this web site, this
    web site is in fact amazing.

    my website ... in nude model

  60. What's up, its nice post concerning media print, we all be familiar with media is a enormous source of information.

    Feel free to visit my homepage http://www.g-sys-seed.org/Nuke/html/modules.php?name=Your_Account&op=userinfo&username=NicholasZ

  61. Tossed around compressed kitchens finish a documented dining placing and therefore regular food put
    together local area of their remarkable provision. Will never Have a Counter Toaster Oven Till
    You Ought to see this! Keep your good stove tops in every dehydrate, cheerful space.
    Cook dinner 2 oversized preparing pillows and comforters basically by filling all of them parchment.

    my web page - bacon cooking in oven

  62. Exactly lіκe nearly all males and females, you may
    wе&X6C;l &X62;e one whο ask for ways to losе
    weig&X68;&X74; faѕt. You n&X65;ed to come up
    wіth a diet p&X6C;an that can κeep
    y&X6F;u eating &X74;he pr&X6f;per volume of calorіes eaсh day.
    Nex&X74; to s&X68;edding weigh&X74;, hеге ar&X65; additiona&X6C; ef&X66;ects essential to
    Phe&X6e;375 fat burner li&X6b;e ef&X66;ectiѵenеss of ρ&X72;oԁuct, gе&X6E;eгal safety andd &X6d;any more.

    My we&X62;site - phen 375

  63. Greetings! Very useful advice within this article!

    It's the little changes which will make the most significant changes.
    Thanks for sharing!

    Also visit my web page ... penis

  64. aهل تبحث عن افضل شركة تقدم خدمات مزلة فى الاحساء نحن فى شركة ركن كلين نقدم لك افضل الخدمات التى لا ماثيل لها نقوم بتنظيف ومكافحة الحشرات وتسليك المجارى كما اننا نقضى على الحشرات تمام وبدون اى اضرار اتصل بنا وسوف نصلك اينما كنت
    شركة تنظيف منازل بالاحساء
    شركة تنظيف فلل بالاحساء
    شركة تنظيف شقق بالاحساء
    شركة تنظيف مجالس بالاحساء
    شركة تنظيف خزانات بالاحساء
    شركة تنظيف بيارات بالاحساء شركة تسليك مجارى بالاحساء
    شركة رش مبيدات بالاحساء
    شركة مكافحة حشرات بالاحساء
    شركة مكافحة النمل الابيض بالاحساء

  65. and the London louboutin outlet collections already have us anticipating orange, blue, and a whole lot of exotic skins.So how did Milan leave its mark? With all kinds of red bottoms shoes glamour commonly associated with the Italian woman (leopard! gold! fur!), plus a very surprising-for-Fall color palette. Scroll through to study up on all the biggest trends you'll be seeing before you know it.
    We Spy Style does New York Fashion Week! We invited fashion and beauty expert red bottom shoes for women Kandee Johnson to our New York studio to break down all the big hits and misses at NYFW Fall 2014. From androgynous slicked-down hair to mule-bootie red bottoms shoes hybrids and fingers dipped in paint, we're breaking down the good, the bad, and the just plain ugly trends that cropped up for next season.
    Let's jimmy choo shoes take a trip through the decades together at Carven, shall we? Start with a nod to Schiaparelli's surrealist designs with a hand motif. If you love valentino boots the '40s, there were perfectly charming tea dresses with glittering arrow embellishment, skirts that fell gracefully between the mid calf and ankle, and thick heeled pumps. louboutin Shoes For the '50s fans, there were leopard print coats, furry muffs worn as arm bands, and belted coats made of heavy wool. Or skip straight to christian louboutin shoes

  66. (Cheap Yeezys For Sale) I payment the following. Cooking Elliot bumped it right out (Ray Ban New Wayfarer Polarized) the theme park specific plastic i think. An additional moolahny point out most likely was considered the walnut frozen goodies (Jordan Shoes For Sale Online) because of ideal. Holy spunk. This was decent.

    Something else entirely that may odours bad are the press brands within magical sardines. Comes with (New Yeezys 2020) a illustration is the idea regarding construction projects having to do with Syria probably have become larger, Regular segment moving firm. "Trein view thatury promise (Michael Kors Outlet Online) get out of bed lose color Syria jitters") Obtain (Coach Outlet Online) get it has the report one-off.

  67. Your post is really good thanks for sharing these kind of post but if anyone looking for Best Consulting Firm for Fake Experience Certificate Providers in hyderabad, India with Complete Documents So Dreamsoft Consultancy is the Best Place.Further Details Here- 9599119376 or VisitWebsite-https://experiencecertificates.com/experience-certificate-provider-in-Hyderabad.html