Question

In: Computer Science

Show some examples of a few Parameters and Objects problems in java language and the solution...

Show some examples of a few Parameters and Objects problems in java language and the solution code. Need more practice as a new learner

Solutions

Expert Solution

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
      
  
      
      
   }

}


Related Solutions

show some example of few recursive problem in java language and the solution code. Need more...
show some example of few recursive problem in java language and the solution code. Need more practice as a new learner
few problems example of array and 2d array and the solution code in java language. I...
few problems example of array and 2d array and the solution code in java language. I am new to java and trying to learn this chapter and it is kinda hard for me to understand.
SOLUTION IN JAVA LANGUANGE NEEDED. JAVA LANGUAGE QUESTION. NOTE - Submission in parts. Parts required -...
SOLUTION IN JAVA LANGUANGE NEEDED. JAVA LANGUAGE QUESTION. NOTE - Submission in parts. Parts required - Dog Class Code, Dog Manager Class Code and the main code. Please differentiate all three in the answer. This Assignment is designed to take you through the process of creating basic classes, aggregation and manipulating arrays of objects. Scenario: A dog shelter would like a simple system to keep track of all the dogs that pass through the facility. The system must record for...
Please show solution and comments for this data structure using java.​ Implement a program in Java...
Please show solution and comments for this data structure using java.​ Implement a program in Java to convert an infix expression that includes (, ), +, -, *,     and / to postfix expression. For simplicity, your program will read from standard input (until the user enters the symbol “=”) an infix expression of single lower case and the operators +, -, /, *, and ( ), and output a postfix expression.
Write a simple shell in C language and show some outputs.
Write a simple shell in C language and show some outputs.
Use JAVA BASICS  classes, aggregation and manipulating arrays of objects. I DO NOT WANT THE SAME SOLUTION...
Use JAVA BASICS  classes, aggregation and manipulating arrays of objects. I DO NOT WANT THE SAME SOLUTION WHICH ALREADY EXISTS ON CHEG. DO NO USE ARRAY LIST Scenario: A dog shelter would like a simple system to keep track of all the dogs that pass through the facility. The system must record for each dog: dogId (int) - must be unique name (string) age (double) - cannot be less than 0 or more than 25 breed (string) sex (char) – m...
Write the simple shell in C language. Please show some outputs.
Write the simple shell in C language. Please show some outputs.
Draw an illustration of the problems including the given & required data. Show the complete solution...
Draw an illustration of the problems including the given & required data. Show the complete solution in legible handwriting. 1. A 64.80 g ball was fired into a 185.00 g ballistic pendulum hanging 7.10 cm from the base of the ballistic device. The ball was trapped in the pendulum bob, and the impact caused the pendulum to swing to a height of 13.70 cm from the base. Calculate the a) velocity of the ball and pendulum after impact b) initial...
This is my C language code. I have some problems with the linked list. I can't...
This is my C language code. I have some problems with the linked list. I can't store the current. After current = temp, I don't know how to move to the next node. current = current-> next keeps making current into NULL. #include #include #include #include struct node{int data; struct node *next;}; int main() {     struct node *head, *current, *temp, *trash;     srand(time(0));     int randNumber = rand()%51;     if(randNumber != 49)     {         temp = (struct node*)malloc(sizeof(struct node));         current = (struct node*)malloc(sizeof(struct node));...
Give some examples of objects or substances mentioned by Dr. Weissman which have negative Hounsfield units...
Give some examples of objects or substances mentioned by Dr. Weissman which have negative Hounsfield units in CT images? What does it mean to have a negative slice spacing in a CT scan? How does it impact the radiation dose? What can you do if a metal object causes streaks in a CT image?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT