It's always best to download software directly from the developer's website. Here's where you should have got Avast from:
https://www.avast.com/en-gb/index
Any software downloaded from Cnet (aka download.com) should, in itself, be perfectly safe. (The people at Cnet do a good job of checking that the software their site hosts is always virus-free). The problem you have to watch out for though is that Cnet gets paid to bundle the perfectly good software (that you actually want) together with things like toolbars (which you almost certainly don't want). They don't do it with all of the software that they host (because the developers of such software sometimes include licence conditions prohibiting it) but you need to watch out for the words 'Installer Enabled' under the green download button. (If you see 'Secure Download' you've no need to worry). If 'Installer Enabled' is shown you can still download and use the software but you need to take great care to select 'Custom Installation' and then to remove the ticks that are in place alongside the 'optional' (i.e. 'unwanted') software which is offered to you.
Cnet's download link for Avast is shown as 'Secure Download', rather than 'Installer Enabled', so your download should be trouble-free.
There are various argument for and against having Java running on your computer but most computers have it running by default. It's important to ensure that it's up to date though, as it can be a way for malicious software to find it's way onto your computer.
NEVER click on any link which offers to update Java (or Adobe Flash or anything else for that matter), as you might have malware on your computer which is trying to get you to accept something really nasty onto it. Instead go to the website of the relevant software developer and get any necessary update from there. This is where you need to go to update Java safely:
https://www.java.com/
If you keep get update notifications, download, install and run the free version of Malwarebytes Anti-Malware to look for anything nasty that could be giving you those messages:
https://www.malwarebytes.org/antimalware/
(NB: When installing it, take care to deselect the pre-ticked option to accept a free trial of the Premium version)