answersLogoWhite

0

1. A method declared as "int" returns an int value.

2. The main() method in Java is not declared as "int", but as "void", meaning it returns no value.

User Avatar

Wiki User

11y ago

Still curious? Ask our experts.

Chat with our AI personalities

BlakeBlake
As your older brother, I've been where you are—maybe not exactly, but close enough.
Chat with Blake
JudyJudy
Simplicity is my specialty.
Chat with Judy
SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve

Add your answer:

Earn +20 pts
Q: What value is return by int main method?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Which of these is an access modifier for a method - void protected int or main?

* void - This is a return type - or, more correctly, specifies that a method has no return type.* protected - This is an access modifier. It says that the only classes that can call this method are subclasses and classes in the same package.* int - This is a value type (or return type).* main - This is the name of the method.


What are return statements in java?

you can understand what is the purpose of return in java after this simple example Basically return use in java to return some values from a method note: this sample will work on all java versions, i test it on JDK 1.4 enjoy the code. file name : Class1.java ----- package mypackage1; //package name public class Class1 //class name + file name the { public String add(int a,int b) //a method in the class; its type is String and it take a and b variables; a and b are int { int answer = a+b; //this is some code in the class; maybe some operations; no need to know whats happening in this method System.out.println("I'm in Class1"); //this is some code in the class; maybe some operations; no need to know whats happening in this method return " I'm the returned value "+ answer; ////this is what you need to take from the method } public static void main(String [] arg) { Class1 c1 = new Class1(); //creating c1 object from Class1 Class System.out.println(c1.add(10,6)); //printing the returned values from the method; } } ----------------- output: I'am in Class1 I'am the returned value 16


What is the default return type of a function?

The normal exit of program is represented by zero return value. If the code has errors, fault etc., it will be terminated by non-zero value. In C++ language, the main() function can be left without return value. By default, it will return zero. To learn more about data science please visit- Learnbay.co


Binary search iterative method over recurssive method?

#include <iostream> #include <conio.h> int linearSearch( const int array[], int length, int value); int main() { const int arraySize = 100; int a[arraySize]; int element; for( int i = 0; i < arraySize; i++) { a[i] = 2 * i; } element = linearSearch( a, arraySize, 10); if( element != -1 ) cout << "Found value in element " << element << endl; else cout << "Value not found." << endl; getch(); return 0; } int linearSearch( const int array[], int length, int value) { if(length==0) return -1; else if (array[length-1]==value) return length-1; else return urch( array, length-1, value); } it is in c++ language ,u can change it to c by including stdio.h ,printf & scanf.....i think it wud be beneficial have a look their too. similar program like that and easy understanding http://fahad-cprogramming.blogspot.com/2014/02/linear-search-program-in-c-using.html


What is the meaning of java void keyword?

The void keyword is used to show that a method will not return a value. // no return type public void setX(int x) { this.x = x; } // returns an int public int getX() { return x; }