Question

1-what do static, private and public modifiers do to methods and fields in java ? 2-difference...

1-what do static, private and public modifiers do to methods and fields in java ?

2-difference between data streams and filtering streams?

3-when should an exception be thrown or catched?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)

If a method or field is marked as private, then only code inside the same class can access the variable, or call the method. The Java access modifier public means that all code can access the class, field, constructor or method, regardless of where the accessing code is located.

Static access modifier links a method or field to the class rather than object of the class, which means that the static methods or fields belongs to the class and are common for all the objects.

2) Data streaming is a feature used to stream through a Collector along which you can do complex operations like filtering, etc.

3) If method can't handle the exception properly, it should be thrown. We generally throw an exception when we want to notify the caller of the method of some failures.

Add a comment
Know the answer?
Add Answer to:
1-what do static, private and public modifiers do to methods and fields in java ? 2-difference...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT