In: Computer Science
Show some examples of a few Parameters and Objects problems in java language and the solution code. Need more practice as a new learner
Hey here is the answer feel free to ask anything realted to this question
I am comfortable in java if you need a Solution in C++ then COMMENT ME i will provide you a Solution in c++ language.
First of all you need to under what is object?
object ->*Object is a instance of class
* object occupy memory
* object is a real world entity
* Object consist of ->
1 -> identity (name)
2-> state
2-> Behaviours
Object syntax->
classname objectname
example-> Animal dog=new Animal(); // we are creating an object and new keyword is used for creating an object
Paremeters -> The argument passed in a method is called method
void man( int a , int b)
Example 1->
package com;
public class World {
  
  
  
   public void hello(int x, int y)// int ,int b is a
parameters and we use void because we are not return any
value
   {
      
       int m=x-y;
       System.out.println(m);
      
   }
  
  
  
   public static void main(String[] args) {
       // TODO Auto-generated method
stub
      
       World w=new World();// w
is a object name and Word is a class name
       w.hello(20,10); // we are passing a
value in a function
      
  
      
      
   }
}

Example 2->
package com;
public class World {
  
  
  
   public int hello(int x, int y)// int x ,int b is a
parameters and we use int because this function return a value
which of off integer type
   {
      
       int m=x-y;
       return m;
      
   }
  
  
  
   public static void main(String[] args) {
       // TODO Auto-generated method
stub
      
       World w=new World();// w is a
object name and Word is a class name
       int x=w.hello(20,10); // we are
passing a value in a function
       System.out.println(x); // return
value store in a variable x and then print it
      
  
      
      
   }
}
