Also, inside the body of the method / constructor?
Also, is there something that can be returned by the constructor? Or can I use " return;" without any expression after it?
return;
In Java, where can a return statement appear? Also, inside the body of the method / constructor?
Only in the constructor or method:
JLS - http://java.sun.com/docs/books/jls/second_edition/html/statements.doc.html#6767
The returned operator returns control to the calling method (§8.4, §15.12) or to the constructor (§8.8, §15.9) .
Also, is there something that can be returned by the constructor?
No
return , , (§8.4) .
"return;" - ?
return Expression , void, - (§8.4), (§8.8)
Java Language Specification, 14.17:
(§8.4, §15.12) (§8.8, §15.9).ReturnStatement: return Expression opt;return , void, - (§8.4) (§8.8). , (§8.7). return Expression , ., return Expression , - .
(§8.4, §15.12) (§8.8, §15.9).
ReturnStatement: return Expression opt;
return , void, - (§8.4) (§8.8). , (§8.7). return Expression , .
, return Expression , - .
, , return , .
return .
return
return , . void return .
( ). , return , .
return void. .
public void test(String s) { if (s.equals("")) { return; } }
return , .
EDIT: , , .
, ( , ). ( ).
- . VM , , , . return , .
"" ( , - ), .
return return . , , . . , , , . . , throw . , , javadoc.
Source: https://habr.com/ru/post/1789070/More articles:What is the easiest way to handle licensing for .NET applications? - c #Using the regular Windows Print dialog box instead of the Java dialog - javaSimple syntax error infuriating me - Ruby on Rails - ruby-on-railsHow to count nodes in XSLT? - xmlhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1789069/uibutton-not-showing-highlight-when-selector-action-is-to-push-a-new-uiviewcontroller&usg=ALkJrhiJRB8qEXhbugvJBgzcESZjQqhTvwUnable to override base property - c #How to save facebook objects between calls in php? - phpDisplay .plist key values in alphabetical order in UITableView - iosProblem with ping broadcast address - networkingError compiling C ++ programs in Visual Studio 2010 - c ++All Articles