Home
About Us
Contact Us
Bookmark
Saved Bookmarks
Current Affairs
General Knowledge
Chemical Engineering
UPSEE
BSNL
ISRO
BITSAT
Amazon
ORACLE
Verbal Ability
→
Java
→
Inheritance in Java
→
In Java, can we make functions inline like C++?(A)...
1.
In Java, can we make functions inline like C++?(A) Yes(B) No
Answer»
Show Answer
Discussion
No Comment Found
Post Comment
Related InterviewSolutions
In Java, can we make functions inline like C++?(A) Yes(B) No
class intWrap {int x;}public class Main {public static void main(String[] args) {intWrap i = new intWrap();i.x = 10;intWrap j = new intWrap();j.x = 20;swap(i, j);System.out.println("i.x = " + i.x + ", j.x = " + j.x);}public static void swap(intWrap i, intWrap j) {int temp = i.x;i.x = j.x;j.x = temp;}}(A) i.x = 20, j.x = 10(B) i.x = 10, j.x = 20(C) i.x = 10, j.x = 10(D) i.x = 20, j.x = 20
class Test {public static void swap(Integer i, Integer j) {Integer temp = new Integer(i);i = j;j = temp;}public static void main(String[] args) {Integer i = new Integer(10);Integer j = new Integer(20);swap(i, j);System.out.println("i = " + i + ", j = " + j);}}(A) i = 10, j = 20(B) i = 20, j = 10(C) i = 10, j = 10(D) i = 20, j = 20
public class Main {public static void main(String args[]) {String x = null;giveMeAString(x);System.out.println(x);}static void giveMeAString(String y){y = "GeeksQuiz";}}(A) GeeksQuiz(B) null(C) Compiler Error(D) Exception
Output of following Java program?class Main {public static void main(String args[]) {System.out.println(fun());}int fun(){return 20;}}(A) 20(B) compiler error(C) 0(D) garbage value
Reply to Comment
×
Name
*
Email
*
Comment
*
Submit Reply
Your experience on this site will be improved by allowing cookies. Read
Cookie Policy
Reject
Allow cookies