[JAVA] I want to call a method of another class

I'm trying to create blackjack (card game) in java. However, the shuffleDeck method written in another class cannot be called in the main method.

I looked it up on the site and books, but I'm not sure ... How can I call it? Please teach me if you like.

Source code

public class Deck {

private int deckCount; // Variable to keep track of the progress of the deck private ArrayList deck; // List deck

//山札(deck)に値を入れ、シャッフルするメソッド public void shuffleDeck(List deck) { // Substitute 1-52 serial numbers in the list for (int i = 1; i <= 52; i++) { deck.add(i); } //山札をシャッフル Collections.shuffle(deck);

}

public class MainGame {

public static void main(String[] args) throws Exception{

System.out.println ("Welcome to Blackjack");

List deck = new ArrayList (52); // The number of cards is 52. The joker is not included. Build a deck so that there are no duplicate cards.

//ここで呼び出したい

}

Recommended Posts

I want to call a method of another class
I want to call a method and count the number
[Ruby] I want to do a method jump!
I want to call the main method using reflection
I want to recursively get the superclass and interface of a certain class
I want to expand the clickable part of the link_to method
I want to make a specific model of ActiveRecord ReadOnly
How to move another class with a button action of another class.
I want to give a class name to the select attribute
I want to develop a web application!
I want to write a nice build.gradle
I want to write a unit test!
I tried to make a parent class of a value object in Ruby
[Rails] I want to send data of different models in a form
I want to pass the argument of Annotation and the argument of the calling method to aspect
I want to output the day of the week
I want to var_dump the contents of the intent
I want to simply write a repeating string
I want to design a structured exception handling
Call a method of the parent class by explicitly specifying the name in Ruby
Rails6 I want to make an array of values with a check box
I want to separate the handling of call results according to the API caller (call trigger)
Cause of is not visible when calling a method of another class in java
[Java] How to use compareTo method of Date class
I made a method to ask for Premium Friday
I want to use a little icon in Rails
I want to know the answer of the rock-paper-scissors app
I want to display the name of the poster of the comment
I want to monitor a specific file with WatchService
I want to define a function in Rails Console
How to mock a super method call in PowerMock
I want to add a reference type column later
I want to click a GoogleMap pin in RSpec
[Rough commentary] I want to marry the pluck method
I want to be aware of the contents of variables!
I want to return the scroll position of UITableView!
I want to connect to Heroku MySQL from a client
I want to create a generic annotation for a type
I want to add a delete function to the comment function
Rspec: I want to test the post-execution state when I set a method on subject
[Ruby] I want to make a program that displays today's day of the week!
I want to use PowerMock in a class that combines parameterized tests and ordinary tests
[Rails] I want to display the link destination of link_to in a separate tab
I want to convert characters ...
How to create a method
[Java] I want to convert a byte array to a hexadecimal number
I want to find a relative path in a situation using Path
I want to implement a product information editing function ~ part1 ~
I want to change the log output settings of UtilLoggingJdbcLogger
I want to make a list with kotlin and java!
I want to make a function with kotlin and java!
I want to create a form to select the [Rails] category
I want to use the sanitize method other than View.
Even in Java, I want to output true with a == 1 && a == 2 && a == 3
I want to create a Parquet file even in Ruby
I want to recursively search the class list under the package
I tried to make a client of RESAS-API in Java
I want to narrow down the display of docker ps
I want to use FireBase to display a timeline like Twitter
[Ruby] I want to reverse the order of the hash table
I want to temporarily disable the swipe gesture of UIPageViewController