Hey guys, welcome to another java tutorial. In this post we're gonna learn about Multiple Methods and Instance.
- First step, clear all the codes in the main class & the sub class.
- OK it's done right? Well this time we're gonna something weird. Yeah, you're gonna display your name & your first girlfriend name on the screen.
- First step clear all old coding in main & sub_clz classes
- Go ahead & declare two variable.
You can I've put "private" before the variable. That because, we wanna use these variables only in this class. If put the " public" you will be able to use it in other classes too.
- Create a method to get the names
This method, it has two parameters and these variable has been equaled variable that declared before. OK What're the values of these parameters. From where they come? That's call patience... Hahaa just kidding.. Look forward to it.
- Another two methods to return the names
- Last one to print the names on the screen
Print it. But there's little bit of difference. there's ''printf " instead of "println" Well that's print function. In print function you can print variables with the string(text in simple).
In the main class
No comments:
Post a Comment