Results 1 to 2 of 2
  1. #1
    rajeev is offline Member
    Join Date
    Jul 2013
    Location
    india
    Posts
    15
    Rep Power
    0

    Default Type mismatch: cannot convert from HdfcBank to GenericBank

    package com.necre.oops2;

    public class GenericBank {

    }//GenericBank class completed here




    package com.necre.oops2;

    public class HdfcBank {

    }//HdfcBank class completed here



    package com.necre.oops2;

    public class Test {
    public static void main(String[] args) {
    GenericBank hb = new HdfcBank();
    }
    }//Test class completed here


    it showing error msg:Type mismatch: cannot convert from HdfcBank to GenericBank
    the reason that i think is that due to HdfcBank class and GenericBank class has no relation i.e inheritance type thats why it showing error , it cant conver HdfcBank to GenericBank..............am i correct or any other reason is there............help me

  2. #2
    jim829 is online now Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,017
    Rep Power
    6

    Default Re: Type mismatch: cannot convert from HdfcBank to GenericBank

    You are correct. To do what you wanted to do HdfcBank would have to extend GenericBank.

    Also, please don't forget to place your code between code tags [CODE][/CODE].

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Replies: 5
    Last Post: 07-12-2013, 02:22 AM
  2. Type mismatch (String)
    By TSTONESIX in forum New To Java
    Replies: 2
    Last Post: 03-12-2013, 04:13 AM
  3. Replies: 3
    Last Post: 03-26-2012, 01:34 PM
  4. Type Mismatch error
    By and0rsk in forum New To Java
    Replies: 2
    Last Post: 10-10-2010, 12:16 PM
  5. Replies: 2
    Last Post: 11-16-2007, 02:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •