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 offline Senior Member
    Join Date
    Jan 2013
    Location
    United States
    Posts
    2,940
    Rep Power
    4

    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 Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

Similar Threads

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