Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
Python
JavaScript
Java
C++
myFruits = ['banana','apple','orange'] myFruits[0] = 'kiwi' print(myFruits) #Python
const myFruits = ['banana','apple','orange']; myFruits[0] = 'kiwi'; console.log(myFruits); //JavaScript
import java.util.Arrays; public class Main { public static void main(String[] args) { String[] myFruits = {"banana","apple","orange"}; myFruits[0] = "kiwi"; System.out.println(Arrays.toString(myFruits)); } } //Java
#include
#include
using namespace std; int main() { string myFruits[] = {"banana", "apple", "orange"}; myFruits[0] = "kiwi"; for (int i = 0; i < 3; i++) { cout << myFruits[i] + "\n"; } return 0; } //C++
Python result:
JavaScript result:
Java result:
CPP result:
['kiwi', 'apple', 'orange']
kiwi,apple,orange
[kiwi, apple, orange]
kiwi
apple
orange