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.
Please Provide the solution in java, already have a question which is answer in C++. Language:...
Please Provide the solution in java, already have a question which is answer in C++. Language: java. Please don't provide your email for private answer. Q1. Implement a program which allows the user to find the shortest path between two nodes in a graph possibly passing through a third node. I.e. the user should be able to ask questions like: Which is the shortest path from A to B passing through C? The program should output an ordered list of...
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.
Please answer with a fully detailed solution with examples. In Java, write a method to determine...
Please answer with a fully detailed solution with examples. In Java, write a method to determine if a string contains only digit characters. In Java, write a method on how to find each occurrence of a letter given a string. In Java, given a list of numbers, write an algorithm to find all the triples and pairs of numbers in the list that equal exactly 13. In Java, write a function to find the total number of each character in...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT