how to put a string in an array parameter java

public class Test {
  public static void main(String[] args) {
    // Declare a constant value for the number of lockers
    final int NUMBER_OF_LOCKER = 100;

    // Create an array to store the status of each array
    // The first student closed all lockers, each lockers[i] is false
    boolean[] lockers = new boolean[NUMBER_OF_LOCKER];

    // Each student changes the lockers
    for (int j = 1; j <= NUMBER_OF_LOCKER; j++) {
      // Student Sj changes every jth locker
      // starting from the lockers[j - 1].
      for (int i = j - 1; i < NUMBER_OF_LOCKER; i += j) {
        lockers[i] = !lockers[i];
      }
    }

    // Find which one is open
    for (int i = 0; i < NUMBER_OF_LOCKER; i++) {
      if (lockers[i])
        System.out.println("Locker " + (i + 1) + " is open");
    }
  }
}

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
pass string array as argument in java put array as parameter java int array from string array how to put an array as a parameter in java array as parameter java parameter will take an array of strings java pass matrix as paramter java array as function parameter array of int java method paramete method to take string or array as params array java parameter how to set an array as a parameter in java Pass string or string array to a function pass an arry as parameters java how to take array a param in java array of strings in java as arguments method to find the parameter of an array in java how to declare a array of string as a parameter passing array of strings to function in java using method as an array how to pass int array values through return method using arrays as parameters java how to pass array as an actual parameter in aragument in java how to pass String array into a method java array of integers as a parameter function string array java pass texts into array string arguments array java array in parameter java parameter array java how to pass an array as a parameter how to pass array as parameter java array parameter java using an array as an argument in a method java java array a stringarg passing array as a parameter in java java how to directly put array in parameter java string array argument call a method and pass an array as an argumen java pass array as parameter take string array as parameter in java how to pass string array in java how to pass a string array as parameter in java java how to write an array as a parameter passing a string array to a method in java how to pass an elemenet into an array in java java pass new array as parameter method with parameters array string array input in a function java array with parameter java java array as parameter call method with array parameters java Method with an array as input arrays as a parameter java pass both a string and an array as arguments java method array parameter java pass array as arguments java array as a parameter java function parameter array string java array parameter how to add array from parameter method java how to add array from parameter java call method with array parameter java array in parameter java java method accept array as argument pass new array as parameter java pass array as parameter java java array as argument method main function java aplication String array parameter method with array parameter java how to specify the string arrays length in method parameters pass string array in java method that accepts an array array as a parameter java java pass string array as parameter can you pass an and modify an array in java passing an array as a parameter java java arrays as parameters method takes array of int java how to pass string array to function in java method with string array as input i have an argument with an array and other values java java pass in new array as parameter java pass in array as parameter passing array parameter java java method with array parameter java pass arguments and create an array java array as argument pass an array to a class java pass string array parameter how to pass in an array of specific size java passing in specific size array java
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source