Java Program to Create Outer Class Bank Account and the Inner Class Interest in it

This is a Java Program to Create the Outer Class BankAcct and Inner Class Interest. We declare the Outer class as BankAcct and inner class as Interest. Now we use the varaibles declared in the outer class to get the output in the inner class. Here is the source code of the Java Program to … Read more

advertisement

Java Program to Check the Accessibility of Static and Non-Static Variable by a Static Method

This is a Java Program to Test whether a Static Method can Access the Static or Non-Static Variable. Here we consider two variables, one as static and other as non static. Now when we print the value of these variables in a static method, we get only the value of the static variable and an … Read more

advertisement

Java Program to Create a Method with 2 Parameters and without Return Type

This is a Java Program to Illustrate a Method with 2 Parameters and Without Return Type. Enter the length and breadth of rectangle as input. Now we pass these values as parameters to the new method where we calculate the area and print the output. Here is the source code of the Java Program to … Read more

advertisement

Java Program to Create a Method without Parameters and with Return Type

This is a Java Program to Illustrate a Method without Parameters and With Return Type. We have made the method to calculate the volume of a cuboid which takes the dimensions length, breadth and height as input and return the volume as output back to the main method. Here is the source code of the … Read more

advertisement

Java Program to Create a Method without Parameters and Return Type

This is a Java Program to Illustrate a Method without Parameters and Without Return Type. We have made the method to calculate area. We call this method from main method and then enter the radius of the circle as input. Now we calculate area and print the output. Here is the source code of the … Read more

advertisement

Java Program to Illustrate Use of Methods in a Class

This is a Java Program to Illustrate Use of Methods in a Class. Here we have made different methods to perform different arithamatic operations. Hence we call these methods from main method to get the output accordingly. Here is the source code of the Java Program to Illustrate Use of Methods in a Class. The … Read more

advertisement

Constructor Program in Java

Problem Description Create a Java program to demonstrate the use of Constructor. What is Constructor in Java? A constructor in Java is a special type of method that is used to initialize an object. It is called when an instance of an object is created and can be used to set the initial values for … Read more

advertisement

Final Keyword in Java

What is Final Keyword in Java? The final keyword in Java is used to create entities that cannot be changed once they are initialized. It can be applied to variables, methods, and classes to make them constants, unmodifiable, or unextendable, providing stability and integrity in the program. How to Initializing a final keyword in Java? … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.