• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

few doubts

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello friends, I have a few doubt

1. can you implement an abstract method like

abstract void meet()
{
System.out.println("Hello");
}?

2. In the scenario,
boolean b = false;
System.out.println("This is "+b);
Can we append boolean value to String with "+" operator?


3.If a method does not throw any Exception, can its overriding method throw Exception?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Krishna, you can find the answer to your questions quickly by writing a small test program. Try it - you learn much more by experimenting yourself than when someone else just gives you the answer.
 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please check this.
1. No you cannot abtract method means no method body this is fine
abstract void meet();

2. Yes anything String + is printable so this will print
This is false.

3.Overriding methid cannot throw any checked exception but yes it can throw unchecked exceptions.
 
reply
    Bookmark Topic Watch Topic
  • New Topic