Professional Documents
Culture Documents
5 Programs On Functions and Constructors
5 Programs On Functions and Constructors
int a
int b
Up to ₹25,000 5.0%
name
price
dis
amt
Member Methods:
Write a main method to create an object of the class and call the
member methods.
Output
(3) Write a program by using a class with the following specifications:
Instance variables:
int num
int f
int rev
Member Methods:
String i
char ch;
Member Methods:
Write a main method to create an object of the class and call the above
member methods.
Output
(5) Write a program by using a class in Java with the following
specifications:
Data members:
String str
Member functions:
void encode() — to replace and print each character of the string with
the second next character in the ASCII table. For example, A with C, B
with D and so on