C/C++/JAVA Question on function

C/C++/JAVA Question on function

"Write a function to find out common alphabets between two arrays. Length of array is not

fixed and may contain other data type also.ΓΆβ?¬Β?

Question can be solved in C,C++ or JAVA.

(Recommneded - C++)

View Answers

June 5, 2013 at 10:15 AM

Hi friend,

To create a dynamic array in Java you may use java.util.ArrayList class. You can add the elements into dynamic array.

Try the following code may this will be helpful for you

import java.util.ArrayList;
import java.util.Iterator;

class ArrayListExample
{
   public static void main(String args[])
    {
          ArrayList list = new ArrayList();
          list.add("Deepak");
          list.add(1);
          list.add("Rose India");
          list.add(2);

         Iterator itr = list.iterator();
         while(itr.hasNext())
           {
                System.out.println(itr.next());
           }
    }   
}

Thanks.


June 7, 2013 at 5:38 PM

Difference between Java and C++

Introduction:

C++ was mainly designed for systems programming and Java was created initially to support network computing.

But today java is provides support for all purpose including internet, distributed system etc.

1.C++ supports pointers whereas Java does not pointers. But when many programmers questioned how you can work without pointers, the promoters began saying "Restricted pointers.? So we can say java supports Restricted pointers.

2.At compilation time Java Source code converts into byte code .The interpreter execute this byte code at run time and gives output .Java is interpreted for the most part and hence platform independent. C++ run and compile using compiler which converts source code into machine level languages so c++ is plate from dependents

3.Java is platform independent language but c++ is depends upon operating system machine etc.

4.Java uses compiler and interpreter both and in c++ their is only compiler 5.C++ supports operator overloading multiple inheritance but java does not.

6.C++ is more nearer to hardware then Java

7.Everything is an object in Java (Single root hierarchy as everything gets derived from java.lang.Object).

8.Java does is a similar to C++ but not have all the complicated aspects of C++ (ex: Pointers, templates, unions, operator overloading, structures etc..)

Java does not support conditional compile (#ifdef/#ifndef type).

9.Thread support is built-in Java but not in C++.

10.Internet support is built-in Java but not in C++.

11.Java does not support header file, include library files just like C++ .Java use import to include different Classes and methods.

12.Java does not support default arguments like C++.

13.There is no scope resolution operator ?:: ?in Java.

14.There is no "goto " statement in Java.

15.Exception and Auto Garbage Collector handling in Java is different because there are no destructors into Java.

16.Java has method overloading, but no operator overloading just like c++.

17.The String class does use the + and += operators to concatenate strings and String expressions use automatic type conversion,

18.Java support call by value only.

19.Java does not support unsigned integer.

From Pankaj Panday









Related Tutorials/Questions & Answers:
C/C++/JAVA Question on function
C/C++/JAVA Question on function  "Write a function to find out common... other data type also.ΓΆβ?¬Β? Question can be solved in C,C++ or JAVA. (Recommneded - C
Difference in XML, C, C++, Java
Difference in XML, C, C++, Java  hi... What is the difference between XML and C or C++ or Java ? please tell me about thatADS_TO_REPLACE_1 Thanks
Advertisements
c c++ - Java Beginners
c c++  Write a small record management application for a school...]; String name = f[1]; String c = f[2]; String note = f[3...]; String name = st[1]; String c = st[2]; String note = st[3]; if (id.equals
c or c++ - Java Beginners
c or c++  Write a program for a two user chess game(Users must be on different systems)? please send me this source code to my mail id with step by step explanation
c c++ - Java Beginners
c c++  Write a Multi-user chat server and client  Hi Friend, Please visit the following link: http://www.roseindia.net/chatserver/index.shtml Hope that it will be helpful for you. Thanks
function
function  difference between function overloading and operator overloading
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
Question
Question   When there is an exception in my program how java runtime system handles
question
question  how to use or call logout function in all jsp
question
question  dear sir/madam my question is how to compare two text format in java..we are java beginners..so we need the complete source code for above mentioned question...we have to compare each and every word
question
question  Gud morning sir, I have asked u some question regarding jsp in saturaday for that i didnot find any answere in which u send me the some...;script> function validate(){ var n=document.form.name.value; var r
question
question  Dear sir i had some typing mistake at previous question so its my humble request to let me know the steps to start the tomcat6 under the tomcat directory
question
and simple java script   // login.jsp <%@ page language="java" contentType... function validate() { var userName=document.valid.user.value; var...; // validation.jsp <%@ page language="java" contentType="text/html; charset=UTF-8
Question?
Question?  My question is how to: Add a menu bar to the program with a File menu. In the File menu, add a submenu (JMenuItem) called About. When the user clicks on the About menu item, display a JOptionPane message dialog
question
;html> <script> function getNumber(){ var num=document.getElementById('num
function addValue
function addValue  i have question about the javascript the function addvalue script is working to add some name but is not save on the html so please resolve my problem what can i do for addvalue function will be to save
function addValue
function addValue  i have question about the javascript the function addvalue script is working to add some name but is not save on the html so please resolve my problem what can i do for addvalue function will be to save
function addValue
function addValue  i have question about the javascript the function addvalue script is working to add some name but is not save on the html so please resolve my problem what can i do for addvalue function will be to save
question related to overloading
question related to overloading  what is difference between function overloading & method overloading
question related to overloading
question related to overloading  what is difference between function overloading & method overloading
isNaN function
isNaN function  What does isNaN function do
If function in PHP
If function in PHP  Hi, Provide me the example of If function in PHP. ThanksADS_TO_REPLACE_1   Hi, If function is PHP is used to check... of if() function in PHP:ADS_TO_REPLACE_2 $book="PHP"; if($book=="PHP"){ echo "Book
Calling a function
Calling a function  Hi, I have a function xyz() in php code. When a button is clicked it should execute that particular function for that i have... function function xyz() { } but this is not working can u tell me
function method
function method  input Rs. 12000 Discount= 10%, 8% = Rs.(12000-1200) = Rs.(10800-864) = Rs. 9936
function method
function method  input Rs. 12000 Discount= 10%, 8% = Rs.(12000-1200) = Rs.(10800-864) = Rs. 9936
using function
using function   using a function to find the value of v from the foiiowing expression 1v=1u+1*f
disable function
disable function  Sir, I have called a java script function when one radio button is checked i want to disable this function when another radio button is checked ,both radio buttons are of same group Please help Thanks in advance
unoin function
unoin function  how to define a union function in java?(ex:a=a U b) how to write tha java code?give ex.   Java Union Function You have learnt union, intersection etc in Sets. Here the given code finds the union of two
Question on pooling
Question on pooling  which server supports pooling?Application server or web server
function method
function method  i. void display(String str.int p)with one string... is an example where we have created a function that accepts a string and an integer...); } }   Here is an example where we have created a function that accepts
question paper - JSP-Servlet
function to select question but it does not work...question paper  I am doing a project in jsp of creating question paper from question bank. Here we have to generate a paper based on the language
Question on javascript
Question on javascript  There will be two combo box in HTML form.If...("A"); arr[2] = new Array("B"); arr[3] = new Array("C"); arr[4] = new Array("D"); function change(combo1){ var comboValue = combo1.value; document.forms["form
Question on reversing word of a sentnce
Question on reversing word of a sentnce  Write a function that accepts a sentence as a parameter, and returns the same with each of its words.... Demonstrate the usage of this function from a main program. Example: Parameter
using function
using function  write a program using function overloading to accept any sentence and print vowels and consonants sepratly   Here is an example that accepts a sentence from the user and display the vowels and consonants
Function pointer in c
Function pointer in c  What is the difference between function call with function pointer and without function pointer(normal function call
c question
c question  How to convert decimal numbers into binary digits without using pow function in c language
This question in Jmeter
This question in Jmeter  hi..i want to send request(xml) 100 times but each time in request xml one element needs to change, otherwise request will be failed since its duplicate
Question on javascript
Question on javascript  This is not exactly what i wanted....If i enter in 2nd combobox as name of child then it should show child id in 1st combobox automatically and vice versa
C# question
Create a Solution by name Bank with Classes Account.cs, SavingsAccount.cs and savingsTest.cs to Demonstrate Abstract Classes in C#  1st question... and savingsTest.cs to Demonstrate Abstract Classes in C
question for c++
question for c++   write Program to swap between two numbers if first number is greater than second number and total of two numbers greater than 10
Inheritance question?
Inheritance question?  Q3)Create a class hierarchy as Company extended by AccountsDepartment. AccountsDepartment extended by AccountsReceivable... as AccountsPayable. please send the code of this question soon....plzzzzzzzz  
Inheritance question?
Inheritance question?  Q3)Create a class hierarchy as Company extended by AccountsDepartment. AccountsDepartment extended by AccountsReceivable... as AccountsPayable. please send the code of this question soon....plzzzzzzzz View
Question in Eclipse
Question in Eclipse   ** Hello EveryOne , L Have Question in Eclipse ?!! Question is : A.( The square class) Design a class named Square that contains : 1.A private instance variable side of type double 2.A no-argument
Question in Eclipse ??
Question in Eclipse ??  ** Hello EveryOne , L Have Question in Eclipse ?!! Question is : A.( The square class) Design a class named Square that contains : 1.A private instance variable side of type double 2.A no-argument
What is the use of friend function?
What is the use of friend function?  What is the use of friend function
call function in php
call function in php  What is the call function in PHP please explain
basic function of computer system
basic function of computer system  What is the basic function of computer system
jsp question..
jsp question..  what should do in deployment descriptor after adding jstl jar files.. I am the the following message in console screen; The absolute cannot be resolved in either web.xml or the jar files deployed
jsp question..
jsp question..  what should do in deployment descriptor after adding jstl jar files.. I am the the following message in console screen; The absolute cannot be resolved in either web.xml or the jar files deployed

Ads