Method/functions In JAVA:

Method/functions In JAVA:

Share It With Your Firends:

In Java A method is a block of code which only runs when it is called. You can pass data, known as parameters, into a method.

public class tut5 {
    static int sum(int x, int y){
        int c = x+y;
        return c;
    }
    // method overloading...
    static int sum(int x, int y, int z){
        return x+y+z;
    }
    static float sum(float a, float b){
        return a+b;
    }
    public static void main(String[] args) {
        System.out.println(sum(2, 4)); // int
        System.out.println(sum(2, 3, 4)); // int
        System.out.println(sum(23.07f, 30.06f)); // float
    }
}

Share It With Your Friends

1 Comment

  • […] thread isΒ a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently. […]

Leave a Reply

Recent Posts

  • All Post
  • A.I.
  • AI
  • c
  • c++
  • computer
  • cryptocurrency
  • database
  • digital marketing
  • finance
  • hacking
  • HTML
  • java
  • Marketing
  • network
  • other
  • programming
  • python
  • react
  • social
  • Tools
  • Uncategorized
  • web devlopment
    •   Back
    • drawing In Python
DIY AI Voice Assistant In Python

September 8, 2023

Build your own AI assistant with Python! Learn to recognize voice commands, generate responses, and more. Create your virtual companion…

share it

Recent Posts

  • All Post
  • A.I.
  • AI
  • c
  • c++
  • computer
  • cryptocurrency
  • database
  • digital marketing
  • finance
  • hacking
  • HTML
  • java
  • Marketing
  • network
  • other
  • programming
  • python
  • react
  • social
  • Tools
  • Uncategorized
  • web devlopment
    •   Back
    • drawing In Python

Additional Content

CodeWithAM

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus luctus.

Products

Automated Chatbot

Data Security

Virtual Reality

Communication

Support

Services

FAQ's

Privacy Policy

Terms & Condition

Team

Contact Us

Company

About Us

Services

Features

Our Pricing

Latest News

Β© 2023 Codewitham