logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology Comments

  • Question
  • What is the difference between a constructor and a method?


  • Correct Answer
  • A constructor is a member function of a class that is used to create objects of that class It has the same name as the class itself, has no return type, and is invoked using the new operator We cannot invoke a constructor directly A method is an ordinary member function of a class It has its own name, a return type (which may be void), and is invoked using the dot operator 


  • Technology problems


    Search Results


    • 1. What are the steps required to execute a query in JDBC?
    • Discuss
    • 2. What is JDBC Driver ?
    • Discuss
    • 3. What is a class, member and local variable?
    • Discuss
    • 4. X implements Y, Z Arguments: 1. X should be class 2. Y, Z should be interfaces

    • Options
    • A. Only 1 is true
    • B. Only 2 is true
    • C. Both 1 and 2 are true
    • D. None
    • Discuss
    • 5. public abstract class Shape { private int x; private int y; public abstract void draw(); public void setAnchor(int x, int y) { this.x = x; this.y = y; } } Which two classes use the Shape class correctly?

    • Options
    • A. public class Circle implements Shape { private int radius;
    • B. public abstract class Circle extends Shape { private int radius; }
    • C. public class Circle extends Shape { private int radius; public void draw();
    • D. None
    • Discuss
    • 6. What is an abstract class?
    • Discuss
    • 7. How will you define an abstract class?
    • Discuss
    • 8. What is the difference between array and ArrayList ?
    • Discuss
    • 9. What is diamond problem?
    • Discuss
    • 10. What is the security mechanism used in java?
    • Discuss


    Comments

    There are no comments.

Enter a new Comment