<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Блок</title>
<style>
div{
display: none;
}
</style>
</head>
<body>
<input type="text" id="inp">
<div class="java_div">java</div>
<div class="javascript_div">javascript</div>
<script>
inp.oninput = function(){
document.querySelectorAll('div').forEach(el=>el.style.display = 'none');
var block = document.querySelector('.'+this.value+'_div');
if(block) document.querySelector('.'+this.value+'_div').style.display = 'block';
};
</script>
</body>
</html>