<?xml version="1.0"?>
<ownershipDocument>

    <schemaVersion>X0508</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2024-11-10</periodOfReport>

    <issuer>
        <issuerCik>0000785956</issuerCik>
        <issuerName>J&amp;J SNACK FOODS CORP</issuerName>
        <issuerTradingSymbol>JJSF</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001851376</rptOwnerCik>
            <rptOwnerName>MALLARD Lynwood</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O J&amp;J SNACK FOODS CORP.</rptOwnerStreet1>
            <rptOwnerStreet2>350 FELLOWSHIP ROAD</rptOwnerStreet2>
            <rptOwnerCity>MOUNT LAUREL</rptOwnerCity>
            <rptOwnerState>NJ</rptOwnerState>
            <rptOwnerZipCode>08054</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isOfficer>1</isOfficer>
            <officerTitle>Chief Marketing Officer</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <aff10b5One>0</aff10b5One>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Common stock, no par value</value>
            </securityTitle>
            <transactionDate>
                <value>2024-11-10</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>F</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionAmounts>
                <transactionShares>
                    <value>49</value>
                    <footnoteId id="F1"/>
                </transactionShares>
                <transactionPricePerShare>
                    <value>176.90</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>1739</value>
                    <footnoteId id="F2"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                    <footnoteId id="F2"/>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <footnotes>
        <footnote id="F1">On November 10, 2021, 484 service share units were issued to the Reporting Person pursuant to a Service Share Unit Award with such shares vesting equally on the first, second and third anniversaries of the grant date.  These shares were withheld to cover taxes associated with vesting of the third tranche.</footnote>
        <footnote id="F2">Includes 511 shares purchased through the J &amp; J Snack Foods Corp. 1996 Employee Stock Purchase Plan.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Michael A. Pollner, Attorney in Fact</signatureName>
        <signatureDate>2024-11-12</signatureDate>
    </ownerSignature>
</ownershipDocument>
